Premature optimization is a quarter of all evil
Brian Will
583

Is there premature error-checking? For example, I stopped writing tests during development (because things are constantly changed / scrapped), but in its place I started littering my functions with as many logic statements as I can think of where I want the function / program to fail.

I found that this has greatly reduced the amount of time I spend in the debugger (not as much as switching to FP has helped though), but now a good portion of my code is filled with assertions or printlines of error messages.

But sometimes I feel tempted to just ‘get the work done’ and I can write more functions / methods… thus holding my train of thought… but then ultimately something will go wrong and I have to hunt around a bit to find out where I messed up.

But again, things change a lot and get scrapped, so if I find that I don’t need that function anymore, or if the parameters change, then I have rewrite those assertions and printline — which thus far, hasn’t been a big problem.

But, after reading this article, and as my code base starts reaching the 10kloc mark, what is a BrianWillRuleOfThumb for this type of situation?

Like what you read? Give f m a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.