1
Reply

Suppose if we have two classes: class A and Class B. How will you make it tightly coupled and then what you should do to make it decoupled.

Gul Md Ershad

Gul Md Ershad

Oct 13, 2016
538
0

    Tight Coupled Code:public class A { }public class B {private A _a;public A(){_a = new A();} }In the above code, B class has dependency on A class.Decoupled Code:Program to Interface is the best way to decouple the code. I will take and Interface and use Dependency Injection specially Constructor Injection.

    Gul Md Ershad
    October 13, 2016
    1