Any developer will tell you that, like men, not all code is created equal. There are certain characteristics that make some code better than others. Phil Johnson, Editor of IT World, put the question “what makes good code” out on online discussion forums and from the replies he got, collated a list of characteristics that real-life developers on the ground believe the answer to be. Here are the top five:
1. It Must Work
This one seems simple, but complicated, unworkable software code is actually quite common. Code written simply, and which the user finds easy to use, is the first step in good code. Johnson quotes a developer, saying “the only metric that matters; there is a user, using the software.” If it doesn’t work simply, it doesn’t work.
Jerry Hill, CTO of Authentic, says that good code should read like real language, “dev’s should always be writing code with the people in mind that will be reading it after them.” adds Hill
2. Easy Readability
Johnson writes that the second most important characteristic of good code is whether it is easily readable by other programmers. “Good naming, clear control flow, and smart smart use of comments all help to make reading code much less of a chore.” Says Johnson.
3. It’s Testable
All software developers that Johnson surveyed agreed that good code should be testable programmatically – meaning that good code is written in a way that will allow automated tests (or units) to be run on it to make sure each component of code is doing its job. Jerry Hill comments that follow-through is key, “the code must be well tested to ensure that it can stand the test of time.”
“No matter how well a piece of code is written, bugs will be found that need to be fixed.” Says Johnson. The ease with which bugs can be fixed and code can be cleaned will determine how good the code is. Easily maintainable code equalled good code to the users Johnson polled.
Alex Malureanu, Co-Founder and CTO at Ascendia says that “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.”
5. It’s Good Looking
Pleasant looking code might not be an absolute deal-breaker here, but the users and developers that Johnson polled felt that “the use of proper formatting like spacing, indentation, and capitalization can make a software programme easier (and more pleasant) to read, and therefore to understand.”
Johnson’s article highlights another three characteristics that make up good code, namely; it’s easy to change, it’s simple, and it’s efficient. To read Johnson’s full article, click here. The overarching message was that good code should be written for the human being using it, and not the computer disseminating it (or the programmer, programming it).
If you’re a software developed accustomed to writing good code, we want to hear from you, send us your CV immediately.