On Duct Tape
There?s this conversation rolling around the developers? world; itstarted with chapter in[URL="http://www.amazon.com/gp/product/1430219483"]Coders at Work[/URL] by the one & only[URL="http://jwz.livejournal.com/"]JWZ[/URL], which I haven?t read, but which[URL="http://www.joelonsoftware.com/items/2009/09/23.html"]Joel Spolskyenthused over[/URL], praising the practice of ?duct-tape programming?.[URL="http://blog.objectmentor.com/articles/2009/09/24/the-duct-tape-programmer"]Uncle Bob Martin weighed in[/URL].I have opinions and examples too.
First, Joel is [I]right[/I] that you want to pay attention to what JWZsays, since he?s shipped more code that more people have used than any dozenor two average programmers. Also he?s funny. So I?ll buy that book.
Joel is [I]right[/I] that complexity is your enemy. We?d all like towrite code to a higher level of abstraction than, say, C and Unix system callsprovide, but when you?re eight levels up the stack in something like Spring orWebsphere, chances are one or two of the levels are going to generally suck,because that?s how life generally is. So it?s really sensible to worry aboutall those levels.
Joel is [I]wrong[/I] to piss on unit testing, and buys into the commonfantasy that it slows you down. It doesn?t slow you down, it speeds you up.It?s been a while since I?ve run a dev team, but it could happen again. If itdoes, the developers will use TDD or they?ll be looking for another job.
In related news, I?m trying to learn Haskell, and it?s a good thing thatI?m using the online[URL="http://book.realworldhaskell.org/read/"]Real World Haskell[/URL]because I would have launched a physical book across the room during theextended snotty lecture about how those poor dynamic-language programmers haveto use unit testing because they lack the miraculous benefits of strong statictyping. [I]Static typing is not a substitute for unit testing.[/I] Sheesh.
Uncle Bob piles on: ?Programmers who say theydon?t have time to write tests are living in the stone age. They might as wellbe saying that man wasn?t meant to fly.?
[B]Problems and Solutions[/B]
But then he says (slightly paraphrased): ?I think that any programmerthat?s not smart enough to use templates, design patterns, multi-threading,COM, etc is probably not smart enough to be a programmer period.?
[I]What?![/I] My experience suggests that there are few surer ways todoom a big software project than via the Design Patterns religion.Also, that multi-threading is part of the problem, not part of the solution;that essentially [I]no[/I] application programmer understands threads wellenough to avoid deadlocks and races and horrible non-repeatable bugs. Andthat COM was one of the most colossal piles of crap my profession ever foistedon itself.
I?d like to agree with Bob?s basic argument, but I don?t think we?re inagreement on problems and solutions.
[B]Consider the Passenger[/B]
Let?s go back to the issue of complexity and layering. My own mostsuccessful software productions have been down-to-the-metal stuff, usually inC, full of memory-mapping and byte-level I/O. But these days, you can getfantastic results with certain highly-layered approaches.Consider my recent write-up on[URL="http://fixunix.com/ongoing/When/200x/2009/09/02/Ravelry"]Ravelry[/URL], which is built inRails, itself a pretty high stack of abstractions.They?re running it via[URL="http://www.modrails.com/"]Phusion?s Passenger[/URL].
Similarly, check out some recent DHH tweets, which I?ll reproduce forconvenience:
[INDENT]Basecamp is now handling more than 50 million Rails requests perweek. We're peaking out at around 200 req/sec. Damn! ([URL="http://twitter.com/dhh/status/4316088063"]*[/URL])
Basecamp's average response time is 90ms and 87% of all requests finish inless than 200ms. Great stats thanks to jumping off virtualization.([URL="http://twitter.com/dhh/status/4316441600"]*[/URL])
Basecamp runs on 4 dedicated Dell R710's (2xL5520@2.27Ghz CPUs with 12GBRAM) serving Rails through Apache/Passenger. Zippy bastards!([URL="http://twitter.com/dhh/status/4317638393"]*[/URL])
[/INDENT]Another Passenger success story. And what is Passenger actually? It?s anApache module. For those who don?t know, an Apache module is about asclose to the raw metal as you can get in Web infrastructure; uncompromising Ccode where you get to munge each request as the server works itshighly-optimized way through the business of parsing and dispatching it anddelivering the results.
This seems like existence proof of the assertion that layering is your friend (as in all that Rails machinery making Ravelry and Basecampmaintainable), but so is being close to the metal (Passenger?s C codegreasing the path between the Internet and the app).
If you read the comments around this debate, it?s increasingly obviousthat we as a profession don?t have consensus around the value of TDD.Many of our loudmouths (like me for example) have become evangelists probablyto the point of being obnoxious. But there remains a strong developer factionout there, mostly just muttering in their beards, who think TDD is another flavor of architecture astronautics that?s gonna slow them down andget in their way.
I think we need to bash this out in public. We need to organize a goodhead-to-head practitioners? debate at a conference or on some good onlineproperty, and see if we can at the very least come to a good understanding ofour disagreements.