4 ms·
If I had to rewrite something from scratch several times I would get very bored and the quality would probably go down. Better to refactor.
by Ididntdothis 7y ago
If I had to rewrite something from scratch several times I would get very bored and the quality would probably go down. Better to refactor.
- usrusr 7y agoI like to refactor in the big and to rewrite in the small. In the big, the n-th rewrite will be just as constrained by how much we can keep in our head at the same time as the original attempt. Refactoring essentially means offloading to the computer what you already have in a computer-readable format. What an opportunity! What I mean with rewriting in the small is taking an existing logic-wart and, while trying to decipher it, taking notes in the form of a rewrite. After finishing the first approximation you take a long, skeptical look at both versions, "is that simple, elegant thing really doing the same?" and then you see the additional corner cases (and/or bugs, sometimes you'll never know) in a clarity that would be impossible to achieve just looking at the original code. It's mostly a reading tool. Sometimes I will trash the rewrite, but often the new version, with the non-obvious bits added will be far more readable than the original because it was written from the perspective of a reader with little knowledge of what the code should do, not by someone deeply immersed in the problem space.
- capableweb 7y agoYeah, if it's a boring problem I would probably get bored too, but I don't think the quality would go down. Naturally, repeating things makes you better each time. Refactor has it's place as well, it's basically rewriting smaller parts in different parts to transform something, you're writing those parts again and again when you continue to refactor for years.