Coding standards can get a bad rap. Too long. Too detailed. Hard to find.
Whatever the reason, it typically means coding standards go unused at best and make you want to light your hair on fire at worst.
So how can you implement coding standards that actually make a difference to you and the work you’re deploying?
One mindset change we’ve explored is thinking less about coding standards as a stagnant, multi-page checklist that you need to cycle through and more as a short-term aid to help you form long-standing habits.
What do we mean by that? Let’s break it down.
James Clear, author of Atomic Habits, has written extensively on forming habits and says:
“A habit is a behavior that has been repeated enough times to become automatic.”
If we can transform an action from something we have to remember into something that is automatic, life gets a whole lot better. And, we can dedicate mindspace to more important things.
Related more specifically to coding, if we can form automatic behaviors around good coding practices that help us improve our software without even thinking about it, the overall work we create will be much stronger.
Make Coding Standards Easy & Obvious
In order to form a habit out of something, it needs to be easy enough to repeat and obvious enough that you can remember. How can you achieve that?
Make your standards visible. Your coding standards shouldn’t just be in a folder somewhere. They should be physically visible to your team. If you’re working in an office, display the coding standards on a wall or in the team’s cube area. If you’re working remotely, put the standards up in your daily scrum board or on a Miro board.
Automate what you can. You don’t have to remember what you automate. Use automation to clean up formatting as much as possible. You save time and reduce errors within your code base plus you’ll look like a better coder.
Simplify your standards. We’ve all seen coding standards that are pages and pages long. Try fitting your standards on an 8.5” x 11” piece of paper. If your standards are much longer than that, you’ll probably ignore them. Start small and add from there.
Creating A System For Change
“You do not rise to the level of your goals. You fall to the level of your systems.”
Systems allow us to continue making progress on our goals even when motivation is low or other responsibilities are taking precedence. By creating a system for assessing and adjusting coding standards, you’ll be able to continue to make progress and deliver stronger products.
Here are a few things we like to do that help us create a system for coding standards:
Develop standards together. The whole team should have a say in what goes into the coding standards. You’ll have more buy-in and there’s a greater chance that the coding standards will actually be used.
Review standards and remove habits quarterly. Each quarter, review your standards and remove anything that has become a habit for your team.
Add rules that need additional focus. Once you have started forming habits within your coding practices, add additional rules to your coding standards to help you continue to improve.
Coding standards carry a lot of opinions with them and will look different for each team and what you’re working to build. If you’re looking for ideas on where to start though, grab our coding standards template here.
This blog originated from a Lean BYTES presentation given by Lean TECHniques Chief Innovation Officer, Tim Gifford. Lean BYTES are short, 16-minute webinars where you can get the quick hits on a variety of development and IT-related topics. Can’t wait to see you at the next one! Register for upcoming Lean BYTES here.