Skip to content

Instantly share code, notes, and snippets.

@ebinjoy999
Last active October 8, 2019 12:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ebinjoy999/b667d4851a20638ca91e7840bfbd9b06 to your computer and use it in GitHub Desktop.
Save ebinjoy999/b667d4851a20638ca91e7840bfbd9b06 to your computer and use it in GitHub Desktop.
//Type1
class A {                                           
private final B b;
                                                                                            
public A() { //Tightly coupled(Not good)
        b = new B(a,b,c,d,e);   //passing ingrediants                       
}                                                                                                     
}
  
//Type2
public class A { //Loosely coupled(Good)
private final B b;
                                                                                                 
public A(B b) {
this.b = b                                                                                          
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment