We relaunched our website earlier this year and started to talk about Clean Code—a term you may have casually used or heard before but may not have synthesized or internalized its true essence. In this post, I will discuss Clean Code and why it matters.
The world runs on code
Software is at the core of every organization and is used to operate its business. Companies realize that the DNA of their software—the source code—is what really matters. It is the most valuable asset of software. Source code not only directs how the application will behave but also how it will perform. Keeping this asset clean will prevent it from becoming a liability.
What is Clean Code?
At a very high level, there are two “qualities” of software that you directly control with source code:
- How the software will evolve, i.e., what is its intrinsic level of changeability. This is such an important criteria that it’s even embedded in the name: ‘soft-ware’. If you cannot change the software anymore, you should probably call it something else!
- How the software will perform when being executed, i.e. will it be robust, reliable, secure, safe? In other words, will it perform correctly?
What is also interesting with Clean Code, is that Clean can mean two things, depending on how it’s used:
- as an attribute, it refers to the state of the code, i.e., code that does not contain problems and is flawless.
- as a verb, it refers to the practice of improving existing code.
We love and embrace this multiplicity!
At Sonar, this is how we look at code, all code.
Imagine a world of Clean Code
Would things be any different if your application’s source code consistently followed high standards?
Maintenance time and costs would be drastically reduced
Not only that, but technical debt would be non-existent and the need to remediate would be absent. Making any change to the application would be so much faster. Instead of constant re-work, developers could be spending more time on innovation and solving interesting and important problems.
Developers’ work environment would be better
As code follows best practices, imagine how easy and pleasant it would be to own this source. Collective code ownership would become the norm–generating emulation and collaboration between developers.
Developers spend most of their time reading and writing code, and having this code clean would mean a significant upgrade to their work environment.
Software longevity would noticeably increase
A clean codebase would make it easier to introduce changes. No more tangled or rigid code and no more fear or frustration around it. The ‘soft’ attribute of code can continue to support changes in business without the need for it to be replaced (which can be costly and disruptive for organizations).
Risks at runtime would be reduced
Operational bugs as well as late security vulnerabilities would not crop up when software is ready for production. This would significantly reduce the risk surface for organizations.
Clean Code provides benefits for every stakeholder.
Software is eating the world. Keeping your code clean creates a better development and operational environment for everyone. Source code is your key asset – build it clean, clean it as you code – avoid it from becoming a liability. The Clean Code movement has begun and Sonar is leading the way.