Possible Duplicate:
When is a BIG Rewrite the answer?
I'm on a small team that's been handed a poorly-written, half-finished 2D Java game. Our objective is to do as much as we can to make it better in about 11 weeks. I'm pretty sure the code is not maintainable and I need to decide if I should pitch the idea of a rewrite (near rewrite, anyway).
For example, the Main class, which is an applet, has most of the game logic just thrown into it. Keyboard and mouse events are handled with huge if/else blocks, none of it is commented (the only comments are the sections of code that have been commented out), and all of the drawing and animation code is just in one huge chunk. Images are loaded in a separate class that just goes through each file, each on a separate line, and reads the image into a static Image variable. This all seems like poor design.
We have until the end of the semester, roughly 11 weeks, to make the game better than it is right now. It's playable but severely broken in spots. I've currently been assigned a small feature to implement: a clickable main menu instead of one that's controllable by keyboard only. On one hand I know I'm capable of implementing this but on the other I'm afraid to try to add new features because a) the more stuff we add the more likely it is that the program will break because of the bad design choices and b) the more I'll be adding to the mess that's already there.
I took the weekend to try to duplicate the basic game functionality with a different design (to see if it could be done quickly enough). I'm able to load and cache sprites, create game entities and move them, and keep track of the game's state to determine which keyboard input to handle and what to draw on-screen. A spritesheet loader was next on my list (I found out that the game art isn't in sprite sheets but each is in a separate file). A trusted friend said that it might be better to have to maintain the old code but looking at it it's too brittle. We could refactor as we go but I think that would be difficult too.
Our group is meeting this Friday. I planned to discuss the idea of an overhaul and present what I've been working on but now I'm not so sure. I feel like it's a simple-enough 2D Java game that once we put together a solid base that it would be a lot easier to add features but we'd have to redesign the base code pretty quickly, probably in two to four weeks or thereabouts. I'd like to think that we can do it that fast but I'm not completely sure.
I guess you could reduce my question down to this: how do you best determine when to maintain poorly-designed code and when to spend some time starting almost completely from scratch?