Search
English

Understanding the 5 SOLID principles from their origins: when to follow them and when it is fine to break them(qiita.com)

startupxo Discuss

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.

Read source ↗

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.

Sign in to comment

Keyboard shortcuts

Choose a post with J and K or the arrow keys, then press Enter.

K ↑ / J ↓
Previous post / next post
Enter C
Open summary and comments for the selected post
O
Open the original link of the selected post
/
Search
?
Show this help
Tab
Move to the submit or comment button, then press Enter

Type normally in text fields. Tab and Enter are always available.