Overview

The SOLID principles lie at the heart of the object-oriented programming.

  • Single-responsiblity principle (S, SRP)
    • a class should have one, and only one, reason to change.

Classes should change for only a single reason.

  • Open-closed principle (O, OCP)
    • you should be able to extend a class’s behavior, without modifying it.

Classes should be open for extension, but closed for modification.

  • Liskov substitution principle (L, LSP)
    • derived classes must be substitutable for their base classes.

Subclasses should be substitutable for their base classes.

  • Interface segregation principle (I, ISP)
    • make fine grained interfaces that are client specific.

Many specific interfaces are better than a single, general interface.

  • Dependency Inversion Principle (D, DIP)
    • depend on abstractions not on concrete implementations.

Depend upon abstractions. Do not depend upon concretions.

  • PLUS: COMPOSITE REUSE PRINCIPLE (CRP)

“Uncle Bob Martin” BOOKS: Agile Principles, Patterns and Practices in C# by Robert and Micah Martin.