3 — YAGNI (You Aren’t Gonna Need It)
Avoid creating functions that are not essential. Focus on what is really necessary, keeping the code simple and direct. The YAGNI practice is important for two main reasons:
- Time Savings: You stop spending time developing functions that you may never use.
- Cleaner Code: Your code becomes clearer and free of assumptions that often turn out to be wrong
4 — TDA (Tell, Don’t Ask)
The TDA principle suggests avoiding asking the object about its state; instead, tell it what to do based on the decision, that is, tell the object what to do.
5 — SOLID
SOLID is a set of five fundamental principles of software design in object-oriented programming. These principles guide developers in creating more readable, flexible, and sustainable software systems. These are not rules, but rather suggestions that will facilitate the life cycle of an application and code.
- S) Single-responsibility principle (SRP): Each object, class, and method needs to have a single responsibility.
- O) Open–closed principle (OCP): Software entities should be open to extension but closed to modification.
- L) Liskov substitution principle (LSP): Objects of a superclass should be substitutable by objects of their subclasses, and the application should still function as expected.
- I) Interface segregation principle (ISP): Software should be divided into several independent parts.
- D) Dependency inversion principle (DIP): We should rely on abstractions, not concrete implementations.