Gul Md Ershad
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.
By Gul Md Ershad in .NET on Oct 13 2016
  • Gul Md Ershad
    Oct, 2016 13

    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.

    • 1


Most Popular Job Functions


MOST LIKED QUESTIONS