* * * * * 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 [1]. 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 [2]. 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 [3] 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 [4] (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 [5] (link via flutterby [6]). I should probably expand my thoughts on this … [1] gopher://gopher.conman.org/0Phlog:2008/06/29.2 [2] gopher://gopher.conman.org/0Phlog:2007/06/13.2 [3] http://en.wikipedia.org/wiki/Fisking [4] http://www.technewsworld.com/story/33398.html [5] http://phillarson.blogspot.com/2008/06/flexibility-is-bad-design.html [6] http://www.flutterby.com/archives/comments/11264.html Email Sean Conner at sean@conman.org .