Created
August 1, 2010 20:23
-
-
Save MarkNijhof/503729 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void DoSomthingWithACar(ICar car) | |
{ | |
// Do something with a any implementation of ICar | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void DoSomthingWithACar(Car car) | |
{ | |
// Do something with a specific Car | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace Fohjin.Refactoring | |
{ | |
public class ClassToBeRefactored | |
{ | |
public void DoSomething() | |
{ | |
DependencyA dependencyA = new DependencyA(); | |
DependencyB dependencyB = new DependencyB(); | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace Fohjin.Refactoring | |
{ | |
public class ClassToBeRefactored | |
{ | |
private readonly DependencyA _dependencyA; | |
private readonly DependencyB _dependencyB; | |
public ClassToBeRefactored() : this(new DependencyA(), new DependencyB()) {} | |
public ClassToBeRefactored(DependencyA dependencyA, DependencyB dependencyB) | |
{ | |
_dependencyA = dependencyA; | |
_dependencyB = dependencyB; | |
} | |
public void DoSomething() | |
{ | |
// Use _dependencyA and _dependencyB | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public double Usage(ICar car) | |
{ | |
// Calculate average kilometers per liter | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public double AverageUsageKilometerPerLiter(ICar car) | |
{ | |
// Calculate average kilometers per liter | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment