DEV Community

Onyedikachi Emmanuel Nnadi
Onyedikachi Emmanuel Nnadi

Posted on

Top 10 Clean Code Rules

An Image showing Clean Code book by Robert C Martin on top of a laptop keyboard.
According to “Clean code” book by Uncle Bob, he defined some guidances and rules that developers should follow. This is more imperative for the less experienced developers. With more experience, comes the possibility of breaking some rules or reinventing them with justifications.

No code comments.
A good code needs no comment. The variables, methods, and any other component of the code such as attributes should use easily identifiable and descriptive names.

“Code comments are smell, remove them.”

Dead comments or code should be deleted.
Any unused piece of code or comments should be deleted. The best place to find them is in the version control systems.

Incorrect behaviour at boundaries.
Boundaries should always be unit tested. No behaviour should be assumed.

Positive conditionals.
Positive conditionals are easier to read than negative conditionals.
click the link to read the full thread
https://x.com/_iamdikachi

Top comments (0)