Today I Learned (2020-06-09)

A Pythonic Guide to SOLID Design Principles

Full article

Single Responsibility Principle (SRP)
Definition: Every module/class should only have one responsibility and therefore only one reason to change.
Relevant Zen: There should be one-- and preferably only one --obvious way to do things

Open Closed Principle (OCP)
Definition: Software Entities (classes, functions, modules) should be open for extension but closed to change.
Relevant Zen: Simple is better than complex. Complex is better than complicated.

Liskov's Substituitability Principle (LSP)
Definition: If S is a subtype of T, then objects of type T may be replaced with objects of Type S.
Relevant Zen: Special cases aren't special enough to break the rules.

Interface Segregation Principle (ISP)
Definition: A client should not depend on methods it does not use.
Relevant Zen: Readability Counts && complicated is better than complex.

Dependency Inversion Principle (DIP)
Definition: High-level modules should not depend on low-level modules. They should depend on abstractions and abstractions should not depend on details, rather details should depend on abstractions.
Relevant Zen: Explicit is Better than Implicit


<< Prev | Next >>