Jeff’s Blog

June 17, 2008

Example of how not to code

Filed under: Uncategorized — Tags: , — jaguth @ 8:02 pm

I found this great example of how not to code at the Daily WTF (thedailywtf.com). Gave me a good laugh 8)

if (what == 0) {
// Code Block A
}
else if (what == 2) {
// Code Block B
}
else if ((what == 1) || (what == 3) || (what == 5)) {

if (what == 1) which = 0;
if (what == 3) which = 1;
if (what == 5) which = 1;
}

// Code Block C omitted for sanity/brevity

if (what == 5) FooBar(position, 3);
else doWibble(position, what);
}

If what? Then which?! Send to FooBar(), else doWibble(). I love the programmer’s naming conventions!

No Comments Yet »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a comment

Blog at WordPress.com.