SOLIDEdit

SOLID is an acronym for the first five object-oriented design (OOD) principles by Ropert C. Martin AKA Uncle BOB, the author of Clean Code.

These principles help you write clean code avoiding common pitfalls such as code smells, refactoring code, spaghetti code and much more.

  • S - Single Responsibility

    Each class should have only one sole purpose, and not be filled with excessive functionality

  • O - Open Closed

    Classes should be open for extension, closed for modification.

    In other words, you should not have to write an existing class for implementing new functionality.

  • L - Liskov Substitution

    This means that every subclass or derived class should be substitutable for their base or parent class

  • I - Interface Segregation

    Interface should not force classes to implement what they can’t do.

  • D - Dependency Inversion

    Components should depend on abstractions not on concretions

See also