Wednesday, July 9, 2008

Working on maintenance projects

first posted on personal blog on Monday, November 13, 2006

It is difficult to understand why people have such an anathema towards maintenance projects. I often come across programmers whose enthusiasm takes a nosedive every time they are asked to work in a maintenance project.

I think, it is an attitude problem more than anything else.


Most projects that I have worked on have been either maintenance (bug fixing) or enhancement projects. If one has the right kind of attitude, working on a bug fixing project can be a very fulfilling experience.


What attitude, you ask? I suggest the following.

All bugs can be replicated and fixed.

All bugs can be detected, analyzed and fixed. If you can't replicate it, don't give up. Check that you are following the right steps. Make sure that your assumptions are correct. Investigate and find out more about the conditions in which the bug was reported.

The software doesn't control you. You control it.

A program does what it is told to do. So even the seemingly erratic/intermittent behavior will have some logical explanation. Don't be afraid of ripping open the class files using a decompiler if needed. As a bug fixer, you are like a private detective. You have access to all areas of the application and you must go through all the code if needed. I once saw a colleague going through the decompiled code of log4j. He was apparently getting some trouble with logging and wanted to understand log4j code to see what was wrong.

...And it's all small stuff.

Don't be smug. Don't ignore trivial causes. Are you running the right build? Are you connected to the correct database? Are you using the right version of code? I can't begin to count the number of occasions where I have done this mistake or have seen someone else doing it. It's like forgetting the attachments in your emails. No matter how experienced you are, you will still catch yourself doing silly mistakes every once in a while.


Be humble.

As I said before, it's software you are working on. Software will have bugs. Even after you fix them, there will still be some more. So don't take it personally if someone points out a bug in your code or if the fix that you provide doesn't work. Be humble and accept your mistakes. I hate to see programmers getting defensive about their code or design.


Pretend that the "Go to" guys don't exist.

Do not get into the habit of raising an SOS every time you see a NullPointerException. There will always be a few star programmers in your project but it irritates them beyond belief if you go asking for their help for every stupid exception that your program throws. Try to fix the problem yourself first. That's what separates good programmers from lazy nincompoops.


Do your homework before seeking help.

In other words RTFM and save the logs. If you do need to take help, do your homework first. Read the specs, do some research, google the error message and find out if someone has already faced it before. Post your query on the forums. And for God's sake, save the logs before calling someone for help.

Be lazy. Automate!!

I learnt this very early. Best programmers are creatively lazy. Automate. Find out tools that can help reduce your time. In short, be a smart coder. If you are working on legacy code, you will need powerful tools and good skills to search the codebase. Learn regular expressions and use them in your searches.


Think out of the box.

People have been known to recover from the dreadful "rm-rf" that someone accidentally typed on a Unix box. The point is, no problem is big enough that it can't be solved. There must exist a solution. And you should find it. Think laterally if needed.


Always get the big picture. Don't forget to ask the "whys".

This is very important. There is a reason why everything works the way it does. There is a reason why your client chose Java over C++ (or vice versa) and there is a reason again in why they chose to not use entity beans. Be inquisitive. Question everything. Get a bigger perspective.It will help you come up with better solutions to problems that you are working on.

No comments: