Dealing With a Mess of Code Today
September 13, 04 by kenrichToday, I had the ominous task of fixing the team information edit page. This involves modifying a web page that is used for 3 different applications and has numerous configuration and security permissions which modify the way it works depending on who you are and which site you log into. Yeah, it’s not exactly the prettiest code in the world and it took me a good 3 hours just to get it working the way it is supposed to.
We have a real mess of code here that is used for many different purposes. All of our sites we build share the same code, so whenever we make a minor change, it affects all of our clients. This is a good thing as far as maintaining code because we can quickly correct issues that affect all of our clients. It becomes a nightmare when we write “client-specific” code for behavior that is only applied to one client’s site.
The code wouldn’t be so bad if we had used a logical way to encapsulate all of the client-specific logic. But instead, we have a rat’s nest of code with lots of conditional statements that make maintaining this beast anything but easy. In fact, most of our time is just spent fixing bugs. We have so many bugs because everything is a rush job and it wasn’t done right the first time. Even my boss admitted this on more than one occasion and he is just as sick as I am of using “patch-worked” code.
It’s not the way to run a professional business because it makes us look bad. This is probably a major reason why our company hasn’t been as successful as it could be. But don’t tell management that they are doing things wrong – they would rather be wrong than successful.