Understanding the 5 SOLID principles from their origins: when to follow them and when it is fine to break them(qiita.com)
Writing language: KoreanRead in the original language
Plain summary
- SOLID is a set of 5 object-oriented design principles meant to reduce cases where fixing one place in the code breaks unrelated places. The author, Sicut_study (of JISOU), explains that Robert C. Martin organized them in a paper in 2000, and Michael Feathers gave them the name.
- Single responsibility says to split code by the party that requests changes. Open-closed says to add features without touching existing code, and the author says to abstract when a second implementation becomes necessary. The author thinks abstract structures built in advance make code harder to read.
- Liskov substitution says a child class must not break the promises of its parent. The author judges that inheritance easily creates tight coupling, so this has become an old principle in modern development.
- Interface segregation says not to make code depend on features it does not use. For dependency inversion, the author says to decide whether to apply it based on whether you want to inject a fake object for testing, rather than on the possibility of replacing the DB. The author stresses that all 5 are guidelines, not absolute rules.
Found on
Qiita ↗ / Published by source
Have you run into something like this? Tell us in a line or two what you did. You do not need to know the product.