Subj : Re: Is well written code a rare species ? To : comp.programming From : Phlip Date : Fri Aug 12 2005 11:28 pm >>> Here is something to think about: http://thedailywtf.com/ . Alan Balmer wrote: > Looks to me as if the entire site is dedicated to bad programming > practices. Read top to bottom. switch (state) { case Enumerations.PageState.Edit: //Load Page Data LoadPageData(); break; case Enumerations.PageState.Update: //Load Page Data LoadPageData(); break; case Enumerations.PageState.Add: //Load Page Data LoadPageData(); break; default: //Load Page Data LoadPageData(); } Poetry! Especially the comments! Now let's guess how it got that way. Charitably. The programmer started with something different in each branch: case Enumerations.PageState.Edit: //Load Page Data LoadPageData("Edit"); break; Then the programmer upgraded LoadPageData to not need the string, and took it out: case Enumerations.PageState.Edit: //Load Page Data LoadPageData(); break; Now without the culture and tests to support strict Refactoring, the programmer is stuck with code half one design and half another. Because it works the risk of even taking the switch statement out is greater than just leaving it in. Maybe someone will need it, some day. Like I said, this is the most charitable assessment. The least is someone needs a new career... -- Phlip http://www.greencheese.org/ZeekLand <-- NOT a blog!!! .