Have you ever asked yourself what makes code great? It is not an easy question to answer as every programmer seems to have a different answer. I always like to take a step back when answering a question like this and consider what code characteristics that I think are great to work with. Consider these 8 must-have characteristics when evaluating the ‘quality’ of your code, no matter the language:
Obviously, clean code is fast code. Code that is clearly written is easier to maintain and tends to be faster because it indicates that the code was correctly developed and refactored to its core purpose.
The characteristic of truly maintainable code is to write it for other people to read. This means a combination of keeping it short, simple and consistent or ‘KISS’; good comments, consistent coding standards, good naming conventions of variables, functions… and clean logic. Above all, always think of those who come after you.
- Well Structured
Well-structured code is basically about how the various objects in a software code base collaborate with each other. This is important to an organization because the structure of software largely determines how long it takes and how expensive it is to develop, test, extend, and maintain a software system.
- Regarded by your peers
Good programmers know good code. You know you are doing a good programming job when your peers have good things to say about your code and prefer to copy and paste from your programs. That’s what it means to be regarded by our peers. It is a testimony to you doing a good job in the profession.
Another important characteristic is how easy is to read and understand the code and its purpose. Good readability means that when a new developer touches the code, it will take less time to understand what the code is doing.
Code that is stable will not cause short dumps. This means more reliable applications and less downtime to the business.
- Follows Standards
This characteristic means that the code follows a set of guidelines, rules and regulations that are set by the organization. It will help programmers more easily understand and maintain source code when it conforms to standards. Adhering to coding standards result in greater consistency and uniformity of delivered code regardless of programmer style.
This characteristic means how easily code can adapt to changing conditions or how easy is it to add new functionality. High extensibility translates into less time for a developer to adapt the code to new functionality.
What other characteristics do you think are must-haves for quality code?