Why do I care about code quality? ✅
Clean code gets a bad reputation sometimes.
Provide some code improvement tips to a developer, and they might respond with…
But my code works! I like how it looks, go away.
— Your favorite developer
Or perhaps you suggest some extra time be factored into a project to clean up the code, and your PM responds with…
I don’t think we have time at this moment, let’s deliver what was asked.
— Your favorite project manager
With such common opposition, why do I still care so much about code quality?
Return on code
Writing code is an investment, especially in most cases where it has to be later maintained or have new features added.
Invest in quality code, and you will reap a valuable return: less issues and quick turnarounds on bugfixes and new features.
From both a business and developer aspect, this seems highly beneficial right? I would say so, and that is why I strongly believe that code quality is something many companies should invest in.
What is quality code?
Clean code is subjective, so if you haven’t noticed I prefer the term quality code.
Foremost, quality code is working code. This means that the examples I used in the beginning are 100% correct: delivering working code is most important.
The problem is that many simply stop right there. The next step is to ensure that code continues to work, and you do that by writing tested code. With proper integration and unit tests, you gain confidence in knowing how your code works and what changes may cause it to break.
Finally, helping with maintenance is consistent code. There are tools that can help out in this regard as well such as ESLint and Prettier, but there are many architectural decisions that will have to be agreed upon and well documented for future maintainers to learn from. Delegating as many of those decisions and enforcements to tools will help prevent future disagreements or developers that want to do it “their own way”.
If it’s even possible to shamelessly plug within my own newsletter, I wrote a very relevant article titled Writing code for your future self.
It starts with one
If you’re a developer in any size company where code quality is not seen as important, you can be the one to change that. Start by setting an example, and slowly suggest the value that automating or enforcing some of these tasks can provide.
🗂 Tab Dump
- Open Graph Image as a Service - Serverless service that generates dynamic Open Graph images that you can embed in your
<meta>
tags. - URL Pages - Create and view web pages stored entirely in the URL
- Haunted - React’s Hooks API implemented for web components 👻
- organize-imports-cli - VS Code’s ‘Organize imports’ executable from command line
📅 Updates
- Reached 1,000 followers on Twitter! 🎉
- New Sunny Commutes episode 73: Branding & indie making with Sergio Mattei (from Shipcast)
- New article Traditional vs modern web development ⚔️
- Met up with Erik Rasmussen, creator of popular open source libraries Redux Form and Final Form. Expect a podcast episode of our chat this week!
- Making some progress in polishing up IronMic which I’m hoping to release soon. Many plans on having podcast guests as well, so stay tuned.
See you next Sunday, same inbox? 👋