I was asked to improve and maintain an internal Web application used and approved by an important community of users. This includes performance improvements and adding features.
Unfortunately, the code is bloated, sometimes very poorly written, and hard to read and change. This makes changes much more difficult to implement.
Despite all of this, the application is good-looking, useful, and users like it and want changes.
That’s why I feel like I have been fooled. Is it really better to write crappy code for quicker great result and glory, then leave for great new projects leaving such an amount of problems behind ?
I have read a lot about this topic on Coding Horror already, but I would like to read more from people here who are experiencing this sad reality, and how they are dealing with it. I might probably need to be given some courage too 😉
As my primary language is not English, please feel free to rewrite this question with better grammar.
This will happen to most programmers. The first urge is to rewrite it. The better approach is to just do what you are being asked to do. If you go into major rewrites you are very likely to break it.
If the changes required are simple you should implement them with as few changes as a possible, in the style that it is already written in.
If the changes are more complicated, then try to apply your changes in as few places as possible. If your plan is to clean up the code over time this is the place to start. Be careful of the changes you make, because you can easily break dependencies you don’t understand. It’s been my personal experience that I can usually add new features or implement changes by actually removing code and rewriting what’s left in any given routine or method.
Resist your temptation to rewrite everything. Look at it as triage. Prioritize changes you would like to see and implement them as you implement changes that are being asked. Avoid affecting code that you are not being asked to change. Don’t force your users to deal with problems from changes you are making just because of aesthetics.