DEV Community

Discussion on: This is Real Life

Collapse
 
hoffmann profile image
Peter Hoffmann

You are oh so right. But just accepting your fate wouldn't be the right path.
First of all, you need some time for a little extra work.
Understand your code, get to know it, add comments and explain it to your rubber duck. In order to change your code you need to know where it came from.
Next you build a solid framework around your code aka tests. Write tests that test the heck out of all your 1000 liner functions, your ten layer deep incestuous class hirachy and all the annoying pre historic js code.
If you've done that you make sure you realy covered all the nifty special and edge cases.
And now get away from all your digital devices and head for some paper, a legal pad, a black/white board or sticky notes. (Successfull) Redesign starts whith a better structure not just new code. Not "new is always better" but "only better is worth the change". Read a book or two, discuss your ideas.

Now you are finaly at the point of writing new code.

Traverse from old still runnig code to backward compatibile polyfixed code. Test everything you write and hope that your changes will proof to be indeed better than what came before.