Jump to content

Clean Code: Difference between revisions

From Knowledge Base
No edit summary
No edit summary
Line 17: Line 17:
== STUPID ==
== STUPID ==
'''Simple, Testable, Ubiquitous, Proper, Incremental, Decoupled''' - This acronym serves as a reminder of what to avoid in code. Striving for the opposite of these qualities ensures code is maintainable and efficient.
'''Simple, Testable, Ubiquitous, Proper, Incremental, Decoupled''' - This acronym serves as a reminder of what to avoid in code. Striving for the opposite of these qualities ensures code is maintainable and efficient.
[medium.com Smart Programmers Write STUPID Code](https://bdicroce.medium.com/smart-programmers-write-stupid-code-397765a14b14)
[https://bdicroce.medium.com/smart-programmers-write-stupid-code-397765a14b14 medium.com Smart Programmers Write STUPID Code]


[https://addyosmani.com/blog/good-code/ AddyOsmani.com Good code is like a love letter to the next developer who will maintain it.]
[https://addyosmani.com/blog/good-code/ AddyOsmani.com Good code is like a love letter to the next developer who will maintain it.]

Revision as of 08:14, 17 January 2025

"Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away."

It is often attributed to Antoine de Saint-Exupéry, the French writer and aviator, from his book Terre des Hommes (1939), known in English as Wind, Sand and Stars.


KISS

Keep It Sweet & Simple - Simplicity is paramount. Methods should be concise, with one expression per line, and names MUST be meaningful. ⚠ DO NOT USE X, DO NOT USE VALUE, DO NOT USE LIST, etc. so not too simple ⚠ Classes should be focused and manageable in size to facilitate ease of change. The balance between readability and conciseness is essential.

DRY

Don't Repeat Yourself - Redundancy is a significant obstacle to clean code and system performance. Identifying and eliminating repetitive patterns is crucial for efficient and maintainable code.

YAGNI

You Ain't Gonna Need It - Solutions should be pragmatic and focused on current requirements. Extraneous features should be avoided unless they are necessary. It is important to remain open to potential future changes and to share any concerns with the team.

DTSTTCPW

Do The Simplest Thing That Could Possibly Work - This principle suggests starting with the most straightforward solution that solves the problem. It is particularly useful for complex problems, helping to clarify understanding and prevent over-engineering.

STUPID

Simple, Testable, Ubiquitous, Proper, Incremental, Decoupled - This acronym serves as a reminder of what to avoid in code. Striving for the opposite of these qualities ensures code is maintainable and efficient. medium.com Smart Programmers Write STUPID Code

AddyOsmani.com Good code is like a love letter to the next developer who will maintain it.

Error creating thumbnail: Unable to save thumbnail to destination