SOLID

SOLID (Single Responsibility, Open Close Principle, Liskov Substitution, Interface Segregation, Dependency Inversion)

Single Responsibility

A class should only have one reason to change. This minimizes the impact of modifications.

Advantages

Open–closed principle

An class / any software entity should be open for extension, but closed for modification.

Advantages

Liskov substitution principle

Let q(x) be a property provable about objects of x of type T. Then q(y) should be provable for objects y of type S where S is a subtype of T. function / functions that use pointers or references to base class must be able to use objects of derived classes without knowing it. in terms of class, objects of a superclass should be replaceable with objects of subclasses without affecting the program’s correctness. A subclass can replace a superclass, if and only if, the subclass does not change the functionality of the superclass.

Interface segregation principle

Clients should not be forced to depend upon interfaces they do not use.

Advantages

Dependency inversion principle

High level modules shouldn’t depend on low level modules. Both should depend on abstractions. Abstractions should not depend on details. Details should depend upon abstractions. Class should depend on interfaces rather then concerte classes.

Clean architecture

Additional Links

  1. Clean Coder - Getting a SOLID start.
  2. Design Principles and Design Patterns