Log in

View Full Version : 5 best practices for Clean Code



charlesprabhu
11-29-2022, 04:32 AM
What is clean code?

Many developers still think that Clean code is all about writing as few lines as possible.
But this is not entirely true.
Clean code is all about making understandable code.

Clean code is not only concise code, but more importantly, it is readable.
A rule of thumb when writing code, is to write code as if comments didn’t exist.
The code should be self-explanatory.

SamHobbs
11-30-2022, 03:54 PM
Is there a universal definition of clean code? I do not know what it is.

Clean code could mean code that looks pretty. Or it could be a reverse engineering and cloning technique that captures copyrighted and patented processes for reconstruction, as in What is Clean Room Design? - Definition from Techopedia (https://www.techopedia.com/definition/26265/clean-room-design).

Or it could be an approach to software development as in:

A case study in cleanroom software engineering: the IBM COBOL Structuring Facility | IEEE Conference Publication | IEEE Xplore (https://ieeexplore.ieee.org/document/17141)
Overview of Clean Room Software Engineering - GeeksforGeeks (https://www.geeksforgeeks.org/overview-of-clean-room-software-engineering)

I agree that it is good to write code that is self-explanatory but that should not be an excuse to not write documentation somewhere somehow.