Re: Best way to develop in parallel
- From: Alan Krueger <wgzkid502@xxxxxxxxxxxxxx>
- Date: Tue, 28 Jun 2005 19:14:06 -0500
Brian wrote:
I have MyPossiblyFlawedClass and MyOtherPossibilyFlawedClass. Both have exactly the same method signatures, constructors, etc.
They solve a number crunching problem using two different algorithms and they're being used to discover flaws in the other. How can I easily switch between the classes? I'm doing it now with an import mypath.classA/classB statement.
But this is getting a bit out of control. I'm constantly switching four import statements many times a day.
Move their common methods into an interface and have each of them implement it. Import them both. Have the test code refer to the interface and construct one or the other based on some condition.
interface A
{
void foo();
} class B implements A
{
void foo() { System.out.println( "B.foo" ); }
} class C implements A
{
void foo() { System.out.println( "C.foo" ); }
} void testA( A a ) { a.foo(); }
void testB() { test( new B() ); }
void testC() { test( new C() ); }
.- References:
- Best way to develop in parallel
- From: Brian
- Best way to develop in parallel
- Prev by Date: Re: I need a command line in Windows NT
- Next by Date: Re: Problems starting jakarta-tomcat 5.5
- Previous by thread: Best way to develop in parallel
- Index(es):
Relevant Pages
|