Reading Code??!!

17 03 2006

Have you ever tried reading the code written by someone else and that too without any comments or documentation to guide you…!! Well! I can inform you right now that it is next to impossible to judge what is going on in it and why something has been added (or subtracted, usually never seen) when it has no meaning at that juncture…

I have got some really nasty pieces of code to read and improve on, and it all started with my first company. My Manager there was a real strict disciplinarian, and he wanted everything I ever did commented on and documented, at that time I was too thick headed to really understand the actual meaning and impact of what he was drilling into me (the discipline and strictness) when dealing with code, which might and will be maintained or read by someone else down the years and at that time he would be looking back as I am now and cursing the person who had the habit of a typical software engineer as is found in our vast congregation of people, who just know how to write code and become ‘Software Engineers’ without even thinking about the basic laws which should be governing us all – writing Good Software and not only good in the sense that it does the work it is meant to do, but is also maintainable for the generations of ‘Software Engineers’ who will follow and WILL have to either maintain that code or discard it as unusable – The Choice Is Ours To Take.

Code writing has been epitomized by excellent books which were forced upon me by my ever strict Manager – Writing Solid Code and Code Complete, then there was After the Gold Rush, and KAIZEN. All these made you feel that you should also be doing something about all this and making your code maintainable and workable in a manner such that generations who come after you, to look at that code which you have left behind in your ever growing zeal to go for better opportunities and work, does not get discarded by them as unmaintainable, or code which is ‘catching your nose from the roundabout way’ when there is a less complex and neater way of writing the same. I am discounting changing techniques in this.

Well! Coming back to the topic of discussion, I think it should be made mandatory for any person who joins the software coding line to first learn the proper way of writing the Logic, Algorithm and Comments/Documentation of the code before he starts coding. I know all those people out there who are too enthusiastic about just getting down to it and streaming out code where they think that they are the smartest of them all and they have (either reused or refactored) code which is the best that is there and they have not even seen whether it is readable by anyone else or not, it is just code and they are the masters of it. I remember my first encounter with this feeling, I was elated that I had completed the first part of the job assigned to me and that too within (before) the time I had been set for it…, I ran to my Manager to show it and it was a web page interface for a defect tracking application that we were developing in-house. Imagine, when he simply did not even see the interface and asked me to show him the logic behind and what my thinking was for the interface created; which naturally being the ever enthusiastic fresher, I had not even bothered about. He saw only code lines and gave me a good blast and me in my naivety told him that I would be writing those after finishing on the development, the aghast look on his face and Him trying to control his temper so as not to hit out on me, told me everything I needed to know about the coding practices that I need to follow before bringing anything like that to him again ever… (that instance I was sent across to the Galgotia’s Book Store to get ‘After the Gold Rush’ and ‘Writing Solid Code’)

Now I face the same, when I have a bunch of freshers under me and they think they are the messiahs of Software Development and each wishes to get into writing code before even getting the feel of what it exactly is… None want to do the grudgingly tedious work involved in testing it out, that is left with the *****, who are unable to make it to the elevated post of a Developer.. More in a later post…

But the best thing is that the person who first constructed the piece of code I am trying to debug and get right, is not aware of these things, also, she/he might have written good code, but the later obliteration’s and additions/subtractions have made the most out of it and made it look bad in the eyes of the person who now has to maintain the same…

So guys! code but make it such that anyone who comes in after you to maintain it does not curses and gets his pressure high on trying to get the thing to work 🙂

Advertisements

Actions

Information

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s




%d bloggers like this: