Search code examples
oopprinciples

Design Principles


What principles do you generally follow when doing class design?


Solution

  • Principles Of Object Oriented Class Design (the "SOLID" principles)

    • SRP: The Single Responsibility Principle A class should have one, and only one, reason to change.
    • OCP: The Open Closed Principle You should be able to extend a classes behavior, without modifying it.
    • LSP: The Liskov Substitution Principle Derived classes must be substitutable for their base classes.
    • ISP: The Interface Segregation Principle Make fine grained interfaces that are client specific.
    • DIP: The Dependency Inversion Principle Depend on abstractions, not on concretions.

    Source: http://butunclebob.com/ArticleS.UncleBob.PrinciplesOfOod

    Video (Uncle Bob): Clean Coding By Robert C. Martin ( Uncle Bob )