Topic 7: Common Closure & Acyclic Dependencies Principles
Kengere Kibwage, Instructor
School of Information Science & Technology • The Common Closure Principle • The Acyclic Dependencies Principle • The Principle • A Change in One of the Dependencies • A Change in an Application Layer • A Change in the Business • Packaging Business Logic • The Tension Triangle of Cohesion Principles The classes in a package should be closed together against the same kinds of changes. A change that affects a package affects all the classes in that package. • Assetic • kriswallsmith/assetic package • Layers are a way to apply the Single Responsibility principle • FOSUserBundle • The Problem With Plugins For Frameworks • The Tension Triangle of Cohesion Principles
Common Reuse principle, Common Closure principle
• Coupling: Discovering Dependencies • Different Ways of Package Coupling • Visualizing Dependencies • The Acyclic Dependencies Principle • Problematic Cycles • Cycles in a Package Dependency Graph • Solutions for Breaking the Cycles • Composition • Inheritance • Implementation • Usage • Object Instantiation • Global Function Usage • Not to Be Considered: Global State • The Acyclic Dependencies Principle • Problematic Cycles • Cycles in a Package Dependency Graph The dependency structure between packages must be a directed acyclic graph; that is, there must be no cycles in the dependency structure. Robert C. Martin, Engineering Notebook • Some Pseudo-Cycles and Their Dissolution • Some Real Cycles and Their Dissolution • Dependency Inversion • Inversion of Control • Mediator • Chain of Responsibility • Mediator and Chain of Responsibility Combined: An Event System