by T Ashok @ash_thiru on TwitterS
Great code is not result of mere unit/dev testing at the early stage. It is really a mindset that is key to producing brilliant code. This article outlines ten things that a developer should be very sensitive to enable the delivery of brilliant code.
In each code fragment, do one thing well. Attempting to do many things can become messy! Stay single-minded in what you are solving with this code.
Accidents happen, inputs may be tainted. Prepare for eventualities, be defensive in your style of coding. After all, it is your responsibility to stay safe!
Reduce clutter in code, it is just about somehow getting the code to do work. Organisation, structure matters.
Avoid magic numbers, hardcoding. Be soft and pliable so that you can modify, extend easily.
Strive to understand the larger context where your code will be used, so that your code delivers value. ‘See the forest for the trees’ too.
6.Be a good citizen
Respect the environment in which the code runs, consume resources only what you need and release them when you need don’t them.
Code begs changes to be done the minute you execute it. Make it maintenance friendly. Also, remember that it may just be you who will maintain the code. Well with time, one also forgets why some things are, the way it is.
It is not just about the functionality, it is about all other ‘-ities’, like security, reliability, compatibility, performance etc. Be sensitive to these aspects while you are coding.
The ability to ascertain if the code is behaving correctly is paramount. Putting it hooks to enable testability enables you to write great code.
Finally great code is not just text that when executed, works correctly. Treat it as a work of art that you produce. Let the choice of names, the structure, the organisation have a sense of aesthetic appeal. After all brilliant engineering becomes art.
About SmartQA The theme of SmartQA is to explore various dimensions of smartness to leapfrog into the new age of software development, to accomplish more with less by exploiting our intellect along with technology. Towards this, we will strive to showcase interesting thoughts, expert industry views through high-quality content as articles, posters, videos, surveys outlined as a SmartQA Digest weekly emailer. SmartBites is “soundbites from smart people”. Ideas, thoughts and views to inspire you to think differently.