All developers sometimes get an assignment to modify an already existing program over and over again. Over time that leads to unreadable and badly designed code. Which is a nightmare and is being b*tched about a lot.
I recently had the same problem. I had to modify a class that did some checks to determine if software was allowed to start-up or perform specific tasks. Well I took a look at the code and said forget it. It’s a complete mess.
Now I have only myself to blame, I wrote the entire code (and all updates that were required). To solve it I made the first wise decision in a long time:). Forget the code change for a while. Instead I made the choice to first refacter the entire class.
Making more functions, more comments and a shipload more sense. It may sound like a counter productive thing to rewrite code, but it safes a lot of time in maintenance!