Home What is Clean Code?
Post
Cancel

What is Clean Code?

Yes, we’re a bunch of Code Monkeys, jumping up and down, thinking we’ve learnt the true meaning of coding. Unfortunately, whenever we grab a few sour peaches and sit proudly on a branch, we’re oblivious to the mess we’ve made. That “working” mess is slowly rotting away right under our eyes!

Clean Code: The Art of Writing Readable and Maintainable Software

In the vast world of software development, where technologies evolve rapidly and coding paradigms shift, one principle remains timeless: write Clean Code.

Any fool can write code that a computer can understand. Good programmers write code that humans can understand.


Contents


What is Clean Code?

  • At its core, Clean Code is about writing code that is easy to understand, read, and modify.
    • It’s not about making code work;
    • it’s about writing code that humans can read, maintain, and scale with ease.

Michael Feathers, author of Working Effectively with Legacy Code, defines it as:

Clean code always looks like it was written by someone who cares.

These words simple yet profound statement encapsulates the essence of Clean Code. It’s about taking pride in one’s work, ensuring that the code is of high quality, and that it resonates with clarity and intent.


The only valid measurement of code quality: WTFs/minute


Clean Code is more than just a set of guidelines; it’s a mindset. It’s about recognizing that code is written for humans first and machines second. By embracing Clean Code, developers not only improve the quality of their software but also foster a culture of excellence, collaboration, and continuous learning.

Why is Clean Code Important?

After years of work, I have noticed a phenomenon:

Many projects become difficult to maintain not because they don’t have a good architectural design or don’t use a good framework, but simply because they don’t have clean code.

The reason why CleanCode is important is really simple: during our work, we spend roughly 80% of the time reading and understanding code.

We need to read and understand code frequently, so reading and understanding code should be easy. Otherwise, we will lose a lot of time and productivity. Or even, the entire codebase will become completely unmaintainable (because no one will be able to fully understand the code).

CleanCode can dramatically improve the productivity of the entire team!

  • CleanCode has the following features:
    1. Readability: Most of the time spent on software is in reading, not writing. Clean Code ensures that developers can quickly understand and navigate the codebase.
    2. Maintainability: As software evolves, it needs updates, bug fixes, and new features. Clean Code ensures that these changes can be made with minimal friction and risk.
    3. Reduced Bugs: Clear and concise code reduces the chances of errors. When code is straightforward, there’s less room for misunderstandings and mistakes.
    4. Collaboration: In team environments, code is shared among multiple developers. Clean Code ensures that everyone can understand and contribute effectively.
    5. Professionalism: Writing Clean Code is a mark of a professional developer. It shows a commitment to craftsmanship and quality.



Reference:

  • Martin, R. C. (2009) Clean code : a handbook of agile software craftsmanship. Upper Saddle River, NJ: Prentice Hall (Robert C. Martin series).
This post is licensed under CC BY 4.0 by the author.
ip