Tuesday, February 24, 2004

Coding Standards

In our last class I mentioned that it is useful to get developers to agree on coding standards, so they are not constantly arguing about indentation styles and naming conventions for variables, classes, methods, ... Lynn Rider's entry which follows shows that something that is well intentioned when taken to the extreme can result in a miserable experience! This is a great (and well told) example of how we can all learn from our experiences. Thanks Lynn!



In Monday night's class, you were talking about how coding standards should be defined 'well' in the beginning, before any coding is ever done. You made a claim that this can save you 3 weeks of time in the long run, as developers love to hash out what is better, more efficient, readable, etc...Although I can see the value in what you said, this brought to mind something that I remember from my internship 2 years ago.



I was working for a company for a few months to fulfill my internship credits for graduation. The company is very well known and takes on mostly defense contracts. When I first got there, my very first day, they handed me two documents to read. The first was their CMMI folder, they happened to be a Level 5. The second they handed me was and Ada Coding Standards document, that was given to them by the government as a standard way to write Ada code when they are working on defense contracts. I was impressed that they were on a level 5 and that they were so precise in how someone should write any little bit of code. I actually enjoyed reading the second book, as it not only told you how to do something, it told you why they wanted you to do it in that manner.



Down the line however, I ended up doing regular code reviews with the other members of our team. When we did code reviews, everyone on the team was involved, as well as the Software Verification people. These usually were slotted for 2 hours at a time, and page by painful page, we would go through all code changes, unit tests, and anything else someone wanted to bring up. If we weren't finished by the end of the 2 hours, we would schedule another 2 hours the next day, and would do this until it was done. There was one particular man in our group, that would sit there and pick apart every last thing. Sometimes he was correct, and sometimes I just think he wanted to be correct. Either way, there were many days I fantasized of that famous Looney-Tune 'anvil' to miraculously drop out of the sky and fall on his head, just so we could move on, often times more than once a day. He was a stickler for these Ada Coding Standards, and although most of the time he was right, there were many times I would bring this book to the meetings, just to stop the 'small war' between the developers. Was it the person? Was it the strict standards imposed by the government? Was it a little of both? And... was this good for us in the end?



For the most part, to me, keeping a standard in place seemed/seems like good idea, but when someone made it their goal in life to argue for 15 mins about the tense of wording in comments or capitalization of the first letter of an index on a for loop or he thought this name would be better suited for one variable or another... what I thought initially was a good thing, turned out to be burdensome and torturous, to say the least. I don't know that we saved time having coding standards in place or not in the long run, all I know is that it gave us more to disagree about, and unfortunately the 'anvil' never came to our rescue. :-)



4 comments: