These classes and methods are all tightly coupled together because of the direct instantiation that is occurring (Remember: New is Glue), though you will also see this behavior if you use static method calls. The dependency tree goes UI -> BLL -> DAL -> DB, and these dependencies are transitive. The result of this approach is that everything in the system is tightly coupled to the database. This method in turn, makes a database query. Within the BLL class's method, a new instance of a Data Access Layer (DAL) class is created, and one of its methods is called. A new instance of a Business Logic Layer (BLL) class is created within the event, and one of its methods is called. When the button is clicked, an event is fired. This type of programming typically lacks sufficient layers of abstraction and results in a very tightly coupled system, since every module directly references lower-level modules.Ĭonsider a user interface form with a button.
It's extremely common when writing software to implement it such that each module or method refers explicitly to its collaborators, which does the same. Abstractions should not depend on details. The Dependency Inversion Principle (DIP) states that high-level modules should not depend on low-level modules both should depend on abstractions.