Author: Clint Cameron, Product Marketing Manager, Sonar
A World Reliant On Code
In a very real sense, software is running the world. Whether they realize it or not, the lifeblood of most companies is their source code. Essentially, the codebase is the DNA and the health of that DNA dictates long-term success. If one takes this viewpoint, then keeping that codebase free from defects is crucial for a strong, healthy organization. It can take years to build up a customer following and just a single vulnerability can erase decades of hard-earned trust.
In the software landscape, cloud native is certainly changing how applications are built, maintained and hosted. It’s at the forefront of how modern companies are staying ahead of the competition by focusing on their core business. With the advent of new technologies such as serverless, Infrastructure as Code (IaC) and Kubernetes, there’s more source code than ever and keeping it clean and safe is essential.
Clean Code Aligns Quality Expectations
It’s already an expectation that developers take ownership of their code reliability (bugs). However, the ownership of maintainability (code smells) and security (vulnerabilities) has traditionally been less clear. In particular, application security hasn’t always been a top-of-mind concern for most developers.
From a developer perspective, there are several reasons for this:
- It wasn’t a clearly defined expectation (especially for security)
- A lack of clear education regarding the problem (identifying code quality issues)
- Insufficient tools for solving the problem (fixing those issues)
It’s tempting to point fingers at developers and demand improvement. While this would clearly be unfair, it’s not unreasonable for users to expect that an application works as intended and doesn’t pose a security risk. This is certainly a reasonable expectation and it requires developers to shoulder more responsibility than just eliminating bugs. It demands a fundamentally different approach to building software.
This new approach starts with an expectation that developers are responsible for all of the quality aspects of the code they write. This means taking responsibility for minimizing bugs, code smells, vulnerabilities and overall code complexity. Just like a sculpter, shaping the stone into art, the developer has their hands on the code and is really in the best position to affect the outcome.
This ideology may seem like a strong stance and yet it is necessary. The reality is that the amount of source code in the world has increased exponentially. The influence of software on the world is undeniable and we’re starting to feel the effects of this weight. It has happened slowly and steadily, but the impact is undeniable – bit by bit, byte by byte – software is eating the world!
Clean Code Brings Sustainability
What is clean code? At a very high level, there are two “qualities” of software that you can directly control with source code:
- First, is how the software will evolve. What is its capability to support future change? This capability is directly reflected in the name: ‘soft-ware’. If the codebase is allowed to reach a state where changes are difficult to implement, then you really can’t call it software anymore!
- The other quality is performance. Will the software be robust, reliable and safe for the user? Will it perform as intended and without compromising user security?
Organizations that proactively control these two qualities put themselves in the best position for long-term success. A healthy, happy codebase is the necessary foundation upon which you can continually build valuable user benefits.
Clean Code in Action
Hopefully, you’re now convinced that your codebase is a very precious resource that requires intentional handling. It’s tempting to think that a codebase evolves somewhat passively over time at least with respect to its cleanliness. Most organizations are very deliberate with their code functionality and passive with their code quality. Precedence is given to code functionality and the overall quality of the codebase declines over time leading to maintainability issues.
Imagine a race car that continually receives the latest technology without receiving maintenance and repair of broken parts. This car is doomed to eventual failure as ultimately the underpinnings will fail to support the increasing demands brought on by the new technology. A codebase is the same, you need a clean, healthy foundation that won’t break under the weight of new code meant to enable new features and functionality.
In practice, this means you must also be intentional with maintaining the quality and safety of your code. This is the meaning of ‘clean code in action’ – and you ignore it at your own peril. Building and releasing apps without following clean code practices is irresponsible because you’re effectively transferring operational and security risks to the user.
Clean code in action really means a couple of things depending on the viewpoint:
- First, as an attribute, it’s code that complies with a defined standard of quality, a codebase containing minimal issues;
- Second, as a verb, the act of finding and fixing “problems” that make the code non-compliant with the standard of quality.
With this viewpoint, there’s a fitting duality and both can be adopted as the proactive way to keep your codebase fit for its purpose. When writing code, you proactively and intentionally ensure it meets or exceeds the defined standard. In always doing this, your codebase has a cleanliness attribute defined by its exceptional quality.
A Clean Code Reality
Shifting to a clean code approach that proactively embraces the quality of your code brings a wealth of benefits across the organization.
Being proactive with quality means low technical debt with developers working on a healthy canvas and solving interesting problems instead of fixing past mistakes.
Good vibes abound
Happy developers are productive developers and fixing old issues in the codebase isn’t much fun. A nice side effect of developers owning code quality is the collective sense of pride that comes with it. Imagine ‘selling’ your company to candidates based on having a tidy, clean canvas on which to build the latest, new features!
Your app lives a long, happy life
A clean codebase makes it straightforward to add new functionality and ensures it reaches the market when it can make an impact. Imagine no longer having unproductive debates over technical debt and whether a sprint(s) must be devoted just to ‘clean things up’.
Users get maximum satisfaction
A clean codebase means operational risk is minimized and users are safe to experience the app as it was intended. Delighted users are the strongest advocates you can acquire.
In reality, a clean codebase benefits all the stakeholders!
A Clean Code Movement for the Win
By taking a more holistic approach and being intentional with the quality of software, the global development community can build sustainable apps that delight users and build customer goodwill. You’ve worked hard to satisfy your customer’s needs and developing with clean code ensures you’re able to deliver on that promise both today and long into the future.
Join the clean code movement, be intentional with the quality of your codebase and take pride in delivering software in a sustainable, responsible way.
Happy, clean coding!