I probably missed this whole discussion, I often do it, but here comes the invitation for brick clans and downvoting ...
If he throws the code, throw it away!
If you do not want to throw it away, follow the tips above. For me, and I write a lot of code, the question of whether it will be thrown away or transferred to a reusable state and saved against a rainy day comes down to economics.
Is it possible to foresee the circumstances in which this code will be useful again? Once in the blue moon, twice a year, every month?
Can I rewrite this code in less time than it takes to make it reusable? If the answer to this question is “No,” how many times will I have to reuse it to upgrade it now? (Back to the previous question.)
If I make this code reusable, can I find it again when I want? (Anyone has ever had the experience of knowing with absolute certainty that somewhere in your code repository there is only the fragment that you want, but without a clue about what it was called, and where to look and what to do, to grep?)
Finally, a three-step approach to writing code fast. Stop after what you need:
1) Document the code as a black box. Inputs, outputs, operations (s). Save this document.
2) Write instructions on how to create / interpret / install the code if you ever have to port it. Write these instructions carefully.
3) Only if it’s worth the effort, improve the quality of the source code so that the code is supported in the future. Make sure the sources are in the source control system and available.
Hi
Mark
High performance mark
source share