!title Inside the Design Mind One of my favorite websites is [[The Daily WTF?][http://thedailywtf.com/]] Every day it has a new example of code that, well, just makes you wonder what the programmers who wrote it were thinking. The number of problems shown in the code snippets is large, but over time you start to see patterns. One recurring problem is conversion, not knowing how to convert from strings to numbers or dates to strings, etc (one can only suppose that the programmers were working alone in an unfamiliar language). Other common problems are date arithmetic, solutions forced with inappropriate language mechanisms, and over-engineering. There are also cases where it’s just clear that someone doesn’t know how to solve problems easily or doesn’t want to. To me, the great thing about the site is not that the code is funny or entertaining, although in the right frame of mind some of it can cause me to laugh out loud (at other times, I’m tempted to weep uncontrollably). No, the thing that makes the site great is the comment section. It’s a portal into the design thoughts of a large cross section of developers… what they think is bad, what they think is good. Every once in a while, a code snippet is offered up as a ‘Daily WTF’ and someone points out that there is a valid reason why someone might want to do things that way !----! and sometimes it isn’t hack-ish. It only looks hack-ish if you aren’t attuned to the design approach of the programmer. One of my favorite examples of this is the [[object wrapper][http://thedailywtf.com/forums/24113/ShowPost.aspx]]. There are many programmers in the field who aren’t used to seeing code this finely factored, so it just looks ridiculous. Is it ridiculous? Well, to me it is suspicious, very suspicious, but I would want to see more of the context. I visit [[The Daily WTF?][http://thedailywtf.com/]] at least once a day. It really pays to know how the broader community sees very concrete design issues. Sometimes I agree, sometimes I don't, but I do know that when helping people find a better way, it pays to know what views are common, and to wonder why. ---- !commentForm !* Wed, 6 Apr 2005 16:36:06, Ben Monro, WTF I love the daily WTF! I suppose for the author of "Working with Legacy Code" this site is a pandoras box of examples. For me, its almost a sort of nostolgia. My former co-workers and I can say "Hey, remember when you did something just like that?" To which the other might reply, "well, that was a long time ago." Perhaps that would be a modified version of the '''Absolver''' Resign Pattern. http://www.dcc.unicamp.br/~oliva/fun/prog/resign-patterns *! !* Thu, 7 Apr 2005 17:27:29, MichaelFeathers, WTF Actually, I ''wish'' I'd seen the site when I was writing the book. It's hard to make up realistic examples of bad code. But, even then, I'm not sure TheDailyWTF would've helped much. There is so much pedestrian bad code out there, code that isn't abjectly bad or bad in a funny way.. just bad in a neglected way. *!
Use alt+s (Windows) or control+s (Mac OS X) to save your changes. Or, tab from the text area to the "Save" button!
Grab the lower-right corner of the text area to increase its size (works with some browsers).