11
Condor
3y

I'm looking at old code that I wrote around half a year ago, and noticed that my coding style changed over time (relying more on arguments to pass messages between commands and functions, rather than sourcing the result of a command). I feel like this old code isn't truly mine anymore. It's thousands upon thousands of lines of code though... Given that, would you rewrite it or just move along with the existing design? I mean in my opinion the current code really sucks.

Comments
  • 4
    its past. you did the best design you could use. over the time you started to like the new design more,
  • 6
    When working with an existing codebase, I'd always recommend following whatever practices and style it uses until it makes sense to do a complete rewrite to something that is actually better and not just the latest preference...

    A complete rewrite doesn't have to be changing the entire style of the codebase, but just rewriting how you do a single thing in a better way, and take it little by little in that way, but should always be done across the entire codebase if you do it...
    If you rewrite everything on every preference change, you'll have little time to do anything else...
  • 2
    Is it doing everything it needs to relatively efficiently and you only need to look at it every few years? Leave it alone, match changes to your old style.

    Are you going to be editing this code a lot or is something significantly not working anymore? Rewrite.
  • 2
    @jeeper Good point! I do not think I'll be looking at this code very often, given how little I looked after it in the past (set and forget basically). Perhaps I could gradually replace the code with new stuff, just keep the behavior the same.. well refactoring I guess. But yeah at this point it's probably a better idea to just go with the old designs.
Add Comment