Professional Documents
Culture Documents
Solid Principles
Solid Principles
Solid Principles
Content
1. Summary
2. Details
Summary
SOLID principles - reduces coupling but facilitate changes
S - Separates concerns
O - Simplify addition/extension
Details
Single Responsibilities Principle [SRP]
We should be able to change one thing without worrying about another ie, we
shall be to change things in isolation.
Prefer cohesive software entities. Everything that does not strictly belong
together, should be separated.
Solid Principles 1
While adding new functionality (code), there should not be any need to change
the old code.
Prefer software design that allows the addition of types or operations without
the need to modify existing code.
Squares and Rectangles are related in maths, but not necessarily in Computer
Science, well again depends on the context.
Make sure that inheritance is about behaviour [function] behaviour not about
data.
Solid Principles 2
Many specifics are better than one general interface mixins - Dependency
Injection
We have a tendency to group in class the things that are named similarly -
Which violates ISP
Eg: copy()
Should Depends on : →
Details → Abstractions
MVC pattern
Eg: copy()
References
Breaking Dependencies: The SOLID Principles - YouTube
Solid Principles 3