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.

Design principles - SOLID

Ruby, OOP, design principles, patterns, SOLID, single responsibility principle, open closed, liskov substitution, depenency inversion.

  • Be the first to comment

  • Be the first to like this

Design principles - SOLID

  1. 1. Software Design Principles
  2. 2. • Former ICU nurse • Joined March 2016 • myUSCIS web team • • @glenn.espinosa on Slack I’m Glenn
  3. 3. • S.O.L.I.D. principles • Where to learn more • Let’s fix some code! Overview
  4. 4. “The intention is that these principles, when applied together, will make it more likely that a programmer will create a system that is easy to maintain and extend over time.”
  5. 5. SRP OCP LSP ISP DIP Single Responsibility Principle
  6. 6. Single Responsibility Principle “A class should have only one reason to change.”
  7. 7. SRP OCP LSP ISP DIP Open/Closed Principle
  8. 8. Open/Closed Principle “Open for extension, closed for modification.”
  9. 9. SRP OCP LSP ISP DIP Liskov Substitution Principle
  10. 10. Liskov Substitution Principle “if S is a subtype of T, then objects of type T may be replaced with objects of type S"
  11. 11. Liskov Substitution Principle “Let q(x) be a property provable about objects x of type T. Then q(y) should be provable for objects y of type S where S is a subtype of T.”
  12. 12. Liskov Substitution Principle “if S is a subtype of T, then objects of type T may be replaced with objects of type S"
  13. 13. SRP OCP LSP ISP DIP Interface Substitution Principle
  14. 14. SRP OCP LSP ISP DIP Dependency Injection Principle
  15. 15. Dependency Injection Principle • High-level modules should not depend on low-level modules. Both should depend on abstractions. • Abstractions should not depend upon details. Details should depend upon abstractions.
  16. 16. SOLID The only certainty is that your app will CHANGE. Program using the S.O.L.I.D. principles to account for that change. Flexible, Modular, Decoupled
  17. 17. Solid code is a pleasure to write and work with.
  18. 18. Additional Resources • Sandi Metz – SOLID Object Oriented Design • Ruby Science by Thoughtbot • Uncle Bob – Principles of OOD • Design Patterns in Ruby