Good practices to get better in Programming
I have been asked this question so many times — “Am I a good programmer ?” I always say “It depends”. Programming is an art and a good code is no less appealing than a nice brush work on the canvas. With technology changing drastically, there are a lot of new concepts to learn, however, I believe the key principles always remain the same.
After being in the engineering line for a while, and working for reputed companies, I can share my experience on few good principles of writing a satisfactory code, and how to always improve along the way
Instead of Copy-Paste, Copy-Understand-Paste
This is a very core and basic principle and is more applicable nowadays when you will get the solution to most of your problem online. Let me share a small example from my life.
In the early 2000 I was working in unix and shell scripting. While analyzing some data, I had to do a group by on a fairly big data set. AWK was very popular to do this kind of quick analytics. So I searched in google — “Group by with awk”. There came my solution
awk '{arr[$1]+=$2} END {for (i in arr) {print i, arr[i]}}'
I quickly pasted this into my terminal and voila — there’s my output. I tested and verified the code on small data set and did not have to change anything. Wow my luck. It…