Clean Code / Design

SOLID

  • S - Single-responsiblity principle

    Every module, class or function in a computer program should have responsibility over a single part of that program’s functionality, which it should encapsulate. All of that module, class or function’s services should be narrowly aligned with that responsibility.

  • O - Open-closed principle

    Software entities (classes, modules, functions, etc.) should be open for extension, but closed for modification

  • L - Liskov substitution principle

    If S is a subtype of T, then objects of type T may be replaced with objects of type S (i.e. an object of type T may be substituted with any object of a subtype S) without altering any of the desirable properties of the program.

  • I - Interface segregation principle

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

  • D - Dependency Inversion Principle

    High level modules should not depend upon low-level modules. Both should depend upon abstractions.

Edit