3 ms·
> When you find large chunks of code that seem to serve no purpose - get rid of those immediately! Yeah, that's a good recipe to break your software in non-obv
by layer8 3y ago
> When you find large chunks of code that seem to serve no purpose - get rid of those immediately!
Yeah, that's a good recipe to break your software in non-obvious ways that only become apparent later, and will end up costing you a lot of money and customer good-will. Chesterton's Fence applies.
My advice: Don't do a full rewrite. Instead rewrite/refactor the most painful parts in small, well-understood increments. Rewriting only 20% may give you 80% of the benefits. Be very conscious and explicit about what your actual pain points are and what exact benefits you'll get by rewriting specific parts.
- BigJono 3y agoYour advice only works if the "large chunk" of code isn't a large chunk of code lol. If you can safely refactor a subset of the code without the full context then of course you'd do that. But if there's a big enough chunk of code that people can't load it into their brain RAM before making a change, it'll just get bigger and bigger as more people tack on drive by changes. If you're past that point, it's time to ctrl-A delete specifically so you can apply Chesterton's Fence on future refactors.
- layer8 3y agoIn my experience it's always possible to proceed in small increments, and that's the safe way to go. Not being able to load a big chunk into your "brain RAM" is actually an important reason for only doing incremental refactors. It doesn’t mean you stop and leave it in some intermediate state. It also doesn’t mean "drive-by changes". It's a coordinated, planned-out and continued effort.