There’s a thousand things waiting to be written once… because they’re each coping with something else that was written once.
Write it twice, then you can use it a dozen ways, and now you’ve got a hundred things to write instead of a thousand.
Write it twice, then you can use it a dozen ways, and now you’ve got a hundred things to write instead of a thousand.
If you write code and don't think it needs to be rewritten, you are either an expert in your domain, or believe you have written code that fits your problem perfectly. Again, if you are not an expert in your domain, then what you have written is at best a solution that works without a second thought, but more likely could use another rewrite. Most software does not need a rewrite, but if we're talking about ways to reuse in a thousand ways, rather than a hundred ways, you need to have the luxury to rewrite code that is used in so many places that it's almost required.