Post

Top 10 Object Oriented Design Principles

  1. DRY (Don’t repeat yourself) - avoids duplication in code
  2. Encapsulate what changes - hides implementation detail, helps in maintenance
  3. Open Closed design principle - open for extension, closed for modification
  4. SRP (Single Responsibility Principle) - one class should do one thing and do it well
  5. DIP (Dependency Inversion Principle) - don’t ask, let framework give to you
  6. Favor Composition over Inheritance - Code reuse without cost of inflexibility
  7. LSP (Liskov Substitution Principle) - Sub type must be substitutable for super type
  8. ISP (Interface Segregation Principle) - Avoid monolithic interface, reduce pain on client side
  9. Programming for Interface - Helps in maintenance, improves flexibility
  10. Delegation principle - Don’t do all things by yourself, delegate it

SOLID: https://scotch.io/bar-talk/s-o-l-i-d-the-first-five-principles-of-object-oriented-design

现在地址跳转到 https://www.digitalocean.com/community/conceptual-articles/s-o-l-i-d-the-first-five-principles-of-object-oriented-design

This post is licensed under CC BY 4.0 by the author.