Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Software Design Principles


Published on

Published in: Education
  • Be the first to comment

Software Design Principles

  1. 1. Software Design Principles Navigator Internal Workshop
  2. 2. Old Story Clean Simple Elegant Rigid Fragile Immobile Change with Requirement Out-of-Control Dependencies
  3. 3. Solution Software Development = Complexity Management Change with Requirement and Follow Principles OCP LSP DIP ISP Clean Simple Elegant Huge but still Clean Simple Elegant
  4. 4. Open Close Principle (OCP) A module should be Open for Extension but Close for Modification Solution: Polymorphism
  5. 5. Liskov Substitution Principle (LSP) Subclasses should be Substitutable for their Base Classes
  6. 6. Liskov Substitution Principle (LSP) Root Cause: Is-A Fails <ul><li>Solution: Design by Contract </li></ul><ul><li>Method pre-condition in subclass shouldn’t be stronger than in base class </li></ul><ul><li>Method post-condition in subclass shouldn’t be weaker than in base class </li></ul>
  7. 7. Dependency Inversion Principle (DIP) Depend upon Abstractions. Don't depend upon Concretions. The Last Mile: Where to instantiate the concrete class?
  8. 8. Interface Segregation Principle (ISP) Many client specific interfaces are better than one general purpose interface
  9. 9. Summary <ul><li>Less </li></ul><ul><ul><li>Responsibilities in a Interface/Class </li></ul></ul><ul><ul><li>Dependencies on Outside Classes </li></ul></ul><ul><li>More </li></ul><ul><ul><li>Abstraction to act as Dependency Firewall </li></ul></ul><ul><ul><li>Small Single-Responsibility Class to Encapsulate Change </li></ul></ul>Manage Complexity = Manage Dependencies Clean Simple Elegant Clean Simple Elegant Clean Simple Elegant Clean Simple Elegant Clean Simple Elegant
  10. 10. More Principles <ul><li>Package Cohesion Principles </li></ul><ul><ul><li>REP: Release Reuse Equivalency Principle </li></ul></ul><ul><ul><li>CCP: Common Closure Principle </li></ul></ul><ul><ul><li>CRP: Common Reuse Principle </li></ul></ul><ul><li>Package Coupling Principles </li></ul><ul><ul><li>ACP: Acyclic Dependencies Principle </li></ul></ul><ul><ul><li>SDP: Stable Dependencies Principle </li></ul></ul><ul><ul><li>SAP: Stable Abstractions Principle </li></ul></ul>
  11. 11. Thank you