…but does it really matter?
That’s something I’ve often asked myself after having written, what I thought at the time, an especially beautiful piece of code. Or a highly performant piece of code. Or a more XYZ standards compliant piece than what was previously written in the XYZ field. Or a… you know.
More than once I wondered: “Ok, this code is highly readable and understandable for a peer, but is it fast enough?”. Or the opposite: “Ok, this code fulfills the very high performance requirement, but is the readability toll too high?”.
In this blog I plan to explore some examples of these issues, where readability is put up against performance, but also against correctness. How correct does a solution have to be to be good enough? Will making it 110% (by adding more than what is needed), 100% or 90% correct impact readability, or performance? Could we make compromises? What effects would that have on the solution?
In the quest for the perfect (good enough?) balance, I’ll also explore how different design choices affect the outcome, for instance if “inheritance vs composition” matters, or if “program against interfaces instead of concrete classes” matters, and if they do then how?
I will look both at the macro and micro scale of the code, from high level modern C++ (mostly) or C# (sometimes) down to generated assembly and machine code (from “native” land) and intermediate language and just-in-time-compiled assembly and machine code (from “managed” land). And all of it will be measured, time-wise, inside out.
Hopefully, in the end, we will have some kind of answer to but does it really matter? - Please join the ride!