Tuesday, July 01, 2008
Proto-thoughts on “You aren't gonna need it” back before Extreme Programming hit the mainstream
Here's one of the rants I handwrote about a decade ago. I don't know … I think I may have lost my mind back then. There were a few bits I couldn't make out—I tended to be a bit lazy in the handwriting department, and I suspect I inherited my Mom's inability to write legibly.
The Lego™ Theory of Programming
Okay, I should point out that I have no idea what the following has to with The Lego™ Theory of Programming. It's not even close to what I understand The Lego™ Theory of Programming is today, and I have to question what I was thinking back then.
Hmm … I seem to be fisking myself here. But oh well, I'm having fun with this, and I can always claim to have changed my mind in the presence of more and better information.
Onwards …
This goes beyond the Theory of Software Reliability. Software Reliability simply states that software should be written with reuse in mind. This leads to the following Theorem:
Um, not quite. “Software Reliability” has nothing to do with “software reuse” and everything to do with “not crashing and losing a hours of work, or maybe a patient or two (or twenty-one).”
So, the names are bad. But not necessarily the theory itself.
The more general the subroutine, the slower it is, the larger it is.
Proof:
int a; int b; int c; c = a + b;anon a; anon b; anon c; c = a + b; if (typeof(a) == int && typeof(b) == int) c = intplus(a,b); else if (typeof(a) == string && typeof(b) == string) c = strcat(a,b);The more general the code, the more code is required to isolate the needed cases.
Proof of b)
larger: more code is required to isolate the particular case, or to extract the particular result from the general case.Proof of [GD?] ([Anon?] B)
Code that isn't there executes faster than code that is executed. Duh!
I'm not sure if I would accept that as “proof” or not, although it does get the point across. And generally speaking, I'm not a fan of generalized code not because it bloats code, but because it complicates the code unnecessarily. And I'm not the only one who feels that way (link via flutterby).
I should probably expand my thoughts on this …