GSD

Three CTOs Answer: What is Good Code?

Posted by Roger Jin on October 2, 2023

Every day, millions of developers write code and labor through code reviews in hopes of contributing good code to the software they're working on.

But what is "good code"?

With new frameworks and programming languages being released every month, it's easy to forget about the fundamental qualities that make for "good code". Sometimes it can just boil down to personal preference or documented conventions, but what else?

blog-cta-any-stack_800x100.png

We thought it'd be interesting to ask some CTO's how they define good code:

Jerry Hill, CTO at Authentic (@AuthenticDgtl)

Jerry Hill, Authentic CTO
Jerry Hill, Authentic CTO

Jerry Hill has been working with software since 1996, after graduating from the University of Southern Missisippi. Today, he oversees the technical operations at Authentic, a full-service digital marketing agency that works with an array of Fortune 500 companies.

“There’s not one thing that I can pinpoint that defines ‘Good Code’. In fact, I like to think there are five factors that should always be considered when building code:

  1. Whether you’re building a product or setting up an implementation of a product, it’s critical to understand what the code will be used for and what type of development is necessary. Application development and implementation development are very different, so it’s important to understand the desired result.
  2. You always want to make sure you avoid doing things that can create future upgrade problems or that will impact future cycle changes.
  3. Be pragmatic in everything that you do. Of the five factors, this is probably the most important. I always try to grasp a full understanding of the requirements and priorities outlined by the client to make sure that the code we build reflects the highest valued pieces.
  4. The code should read like real language. Development should always be writing code with the people in mind that will be reading it after them. So, it’s important to use strategies where you can reference variables as nouns and methods as verbs. This helps cut down on needing tons of comments and complexity in management.
  5. Follow through. The code must be well tested to ensure that it can stand the test of time.”

Alex Malureanu, Co-Founder and CTO at Ascendia (@AlexMalureanu)

Alex Malureanu, Ascendia CTO
CaAlex Malureanu,
Ascendia CTOption

Since Co-Founding Acendia over a decade ago, an eLearning platform, Alex Malureanu’s main role has to develop new eLearning and mLearning products for broad audiences.

“Good code is not only about getting the task done. It’s about writing something that permits easy modification later on. After all, in today's world, we need to modify code as much as we need to write it.

blog-cta-any-stack_800x100.png

That's why, for our team, one of the most important traits of "good code" is readability. Even if it's not using the most elegant approach or it's buggy, the fact that you can easily read it and understand the approach of the developer makes it easier to modify, build open and delete where necessary.  

With readable code, you can find faster a better approach or bugs, improve it more easily and make it more elegant. Writing readable code will also improve other important aspects of it: speed for the end user, reviewability, low error rates and so forth.

It is not a time consuming task and it will payback when you will read it only once to understand it, rather than reading multiple times bad code.

Good code should also explain itself to anybody trying to read it, and this can usually be done by sufficient naming, structure, directionality, and so forth.

Bad code, on the other hand, always has signs of duplication or is superfluous in nature, making it difficult (and annoying) to read.

Alas, good code is not always void of redundancy or confusion, but it should at least keep such chaos to a minimum.”

Lauri Tunnela, CTO and Co-Founder at Paranotek (@WorldFlix)

Lauri Tunnela, PAranotek CTO
Lauri Tunnela, Paranotek CTO

Lauri Tunnela has over 10 years of IT experience, and now works on developing Paranotek, the cyber security and privacy software.

“First of all, I always recommend following the coding standards and conventions of whatever programming language is being used. This may sound like obvious advice, but many developers go wrong here.

By following the the pre-set standards, code will stay clean and readable, making it easy for anyone to read it or produce completely new code on top of it. If you start to deviate from those coding standards, you make life difficult for anybody collaborating with you.

Most of the IDEs support code linters which will actually tell a programmer if they are not following the standards specific to a language being used. Also, some IDEs even automatically reformat code in case it is badly formatted. I’ve found those tools to be very helpful, but I always recommend that developers should try their best to learn from those corrections, instead of just relying on them totally.

Secondly, when coding standards and conventions are being followed, it is very important that everyone in a project or company follows suit. The last thing you want is everybody coding in a slightly different way.

Thirdly, even if everyone is following the same standards and conventions, this does not guarantee the quality of the code. Before any coding takes place on a major project, the developers should come together to actually determine what is it that is being coded. After that has been determined, the next thing is to plan the fastest (and most creative) way to produce the actual piece of code. After a plan is made, programming work can begin with everybody on the same page, so to speak.”

What we've learned

Code should be written for humans, not just for computers.

What’s your definition of good code? Let us know in the comments section below.

 And if you liked these expert insights, check out our article about managing deadlines.

 

Receive articles whipped up for developers and CTOs.
    
Roger Jin

Roger Jin is an engineer at ButterCMS. He loves talking and pairing with other developers. You can find him at roger@buttercms.com where he will definitely reply to you.

ButterCMS is the #1 rated Headless CMS

G2 crowd review award G2 crowd review award G2 crowd review award G2 crowd review award G2 crowd review award G2 crowd review award G2 crowd review award G2 crowd review award G2 crowd review award G2 crowd review award G2 crowd review award G2 crowd review award

Don’t miss a single post

Get our latest articles, stay updated!