Skip to content

Instantly share code, notes, and snippets.

@patrykpoborca
Last active August 29, 2015 14:27
Show Gist options
  • Save patrykpoborca/92c9d5bba9fde78b28e3 to your computer and use it in GitHub Desktop.
Save patrykpoborca/92c9d5bba9fde78b28e3 to your computer and use it in GitHub Desktop.
public class AnotherClass {
private final MyClass myClass;
public AnotherClass(MyClass myClass){
this.myClass = myClass;
}
}
public class Main{
public void doingSomething(){
//Now if either AnotherClass or MyClass changes its implementation, we have it limited to instnatiation
AnotherClass anotherClass = new AnotherClass(DependencyFactory.providesMyClass());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment