The Daily WTF

A friend of mine pointed me to this website, The Daily WTF, Curious Perversions in Information Technology.
On this website you can get your daily dose of funny, stupid or weird bits of programming code.

How about this bit of code for converting a byte array to hexadecimal?
Notice the use of constants to improve readibility, such as:

public static final int FIRST_BIT_OFFSET = 1;
public static final char ZERO = '0';

Here’s another nice example of the use of constants, to make SQL query building much easier!

This one’s for people who don’t understand boolean logic:

if ((actionFlag == 0) && (actionFlag == 1))


if (connectionOpen || !connectionOpen)

or this example, showing the inefficient way of variable assignment:

if ( BitCount != 8 )
expectedBits = 8;
expectedBits = BitCount;

One final entry shows the code you need to use, if your < key doesn’t work.

Tags: , ,

Tuesday, April 4th, 2006 Computing, Funny

No comments yet.

Leave a comment