在我的团队成员在我们的项目中创建 class 之前,在我的函数中使用 java class
Using a java class in my function before my team members have created the class in our project
我正在与一名团队成员合作,我正在实施 class,而他正在实施 class。我们在 Java.
工作
我的 class 依赖于我的团队成员 class:
public myClass(MyTeamMemberClass a) {
//do stuff
}
我的团队成员正在构建他的 class,我正在构建我的 class,但是我们在不同的 git 分支上,所以他的 class 不可用对我来说。
What is the best way to stub this dependency while I wait for his code commit?
Is it just to change the dependency type to Object, wait for the commit, and then change to the correct type or is there a more elegant
way?
在你们共同处理这个问题之前,你们需要决定要为哪个接口编写代码。如果你对你的团队成员class的职责还没有一个大概的概念,因此不能拉出一个界面,那么你应该考虑结对编程,直到你能决定第一个版本的界面应该是什么样子.
您应该为您的团队成员 class 创建此界面,现在可以签入:
public interface MyTeamMemberInterface {
// ...
}
public myClass(MyTeamMemberInterface a) {
//do stuff
}
您的同事现在可以单独处理上述接口的实现:
public class MyTeamMemberClass implements MyTeamMemberInterface {
//...
}
执行此操作的最佳方法是编写 class,并让您的需求决定界面的外观(也许使用 TDD)。在此之后,您可以与您的团队成员一起实施。
我正在与一名团队成员合作,我正在实施 class,而他正在实施 class。我们在 Java.
工作我的 class 依赖于我的团队成员 class:
public myClass(MyTeamMemberClass a) {
//do stuff
}
我的团队成员正在构建他的 class,我正在构建我的 class,但是我们在不同的 git 分支上,所以他的 class 不可用对我来说。
What is the best way to stub this dependency while I wait for his code commit?
Is it just to change the dependency type to Object, wait for the commit, and then change to the correct type or is there a more elegant way?
在你们共同处理这个问题之前,你们需要决定要为哪个接口编写代码。如果你对你的团队成员class的职责还没有一个大概的概念,因此不能拉出一个界面,那么你应该考虑结对编程,直到你能决定第一个版本的界面应该是什么样子.
您应该为您的团队成员 class 创建此界面,现在可以签入:
public interface MyTeamMemberInterface {
// ...
}
public myClass(MyTeamMemberInterface a) {
//do stuff
}
您的同事现在可以单独处理上述接口的实现:
public class MyTeamMemberClass implements MyTeamMemberInterface {
//...
}
执行此操作的最佳方法是编写 class,并让您的需求决定界面的外观(也许使用 TDD)。在此之后,您可以与您的团队成员一起实施。