Pro EP 65 : SOLID, DRY, KISS, YAGNI and Hollywood Principle

Muhammad Waseem
Become .NET Pro !
2 min readOct 6, 2023

--

Lost in the maze of coding principles?

Today, let’s decode SOLID, DRY, KISS, YAGNI, WET, and HOLLYWOOD.

1. 𝗦𝗢𝗟𝗜𝗗 — A beacon of good design

Single Responsibility: One class, one job.

Open-Closed: Open for extension, closed for modification. Sounds like a secret society, doesn’t it?

Liskov Substitution: Child classes must be substitutable for their base classes.

Interface Segregation: Clients shouldn’t be forced to depend on interfaces they don’t use.

Dependency Inversion: High-level modules shouldn’t depend on low-level ones. Both should depend on abstractions.

2. 𝗗𝗥𝗬
Don’t Repeat Yourself: If you’ve written it once, don’t write it again. Code duplication creates more places for bugs to hide.

3. 𝗞𝗜𝗦𝗦
Keep It Simple, Stupid: Complexity is the enemy of understanding. Keep your code as simple and straightforward as possible.

4. 𝗬𝗔𝗚𝗡𝗜
You Aren’t Gonna Need It: Do not add functionality until you absolutely need it. A minimalist approach to code can save time and reduce complexity.

5. 𝗪𝗘𝗧
Write Everything Twice: Contrary to DRY, WET suggests duplicating code can sometimes make sense, especially when the cost of making it reusable outweighs the benefits.

--

--