How to Make Clean Code a Priority

Written by Alton Zenon III
Published on Jul. 20, 2020
Brand Studio Logo
H-E-B team working
h-e-b

Forget the well-worn stereotype of the lone, hoodie-donning coder.

In Claire Lee’s experience, software engineering is a collaborative activity that depends on establishing common practices as a team and sticking to them.

“Many bad coding habits stem from overvaluing personal preferences or ability,” Lee, a senior UI engineer with roughly a decade of development experience, said.

Legibility is one of the ultimate goals of working from a shared codebase, and Lee said that individuals who code with a team-oriented mindset produce cleaner, more maintainable code. Lee works on the digital arm of the grocery retailer H-E-B, and said her engineering team relies on frequent feedback and code reviews for alignment. When developers defer to personal preference — like using vague or custom naming conventions — it can make code more difficult to read and update as business requirements change. 

 

Image of Claire Lee
Claire Lee
Senior UI Engineer • H-E-B

When it comes to writing clean code, what are some best practices you follow, and why?

Clean code is easy to understand and maintain. Using meaningful names helps clearly convey purpose. It’s easier to remember what a variable named “description” does than one named “d.”

Having good conventions for code structure and organization improves code readability and decreases risk and frustration when making updates. This idea includes having small, focused functions and data structures with easy to understand roles and responsibilities.

Code reviews are a good place to advocate for and learn about good programming habits.”

 

What are some bad coding habits that you wish every developer would stop doing?

Many bad coding habits stem from overvaluing personal preferences or ability. For example, writing code that doesn’t conform to the styles that a team agrees upon makes it harder for other developers to understand and work with that code. Premature optimizations or attempting to write a custom solution — when a tried and tested one exists — can lead to code that’s more difficult to update and maintain as business requirements change.

How does your team make clean code a priority?

We seek feedback from one another and work to improve as a team. Code reviews are a good place to advocate for and learn about good programming habits. They also help ensure the entire team is in alignment. 

Additionally, we have chat channels and meetings where we’re encouraged to bring up broader questions about our technical approach and coding patterns. Having an environment that fosters asking questions and sharing experiences has helped us grow as an engineering team and as individuals.

Responses have been edited for length and clarity. Images via listed companies.