Stop writing silver bullets

Adam Crockett 🌀 - Nov 30 '19 - - Dev Community

When I create a library / abstraction, it's usually quite small maybe around 300 lines, it's purpose should be singular, and everything around naming, methods and public is considered, I do no more than I need too, I will attempt to be quite generic, and so you would think this must be reusable?

I find more and more that my code is reusable, I know because I do reuse it, but actually it's only chunks that I need from a previous solution, rarely will I need everything and often 50% gets cut. This got me thinking, if code should be reusable, why do I have to cut code?

I think I may have a form of overengineering addiction where my solutions are not actually focused enough. Why write a SVGCurve maker and it only does that, when you know what your making further down the line is more specific. The generic SvgCurve maker does need to make calculations that the consumer library could skip because part of the calculation is already known. The generic solution then needs to allow for overides to bypass the calculation... But by now, I'm thinking what's the point?

There is no silver bullet, perhaps keep your functions pure, calculate before you pass values in, just return values out, be focused and maybe this means less cut code.

End of streaming consiusness. 😴

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Terabox Video Player