[SATLUG] San Antonio's Daily WTF
dkowis at shlrm.org
Fri Dec 1 13:38:31 CST 2006
-----BEGIN PGP SIGNED MESSAGE-----
Mike Wallace wrote:
>> I showed you mine, now show me yours. Please tell me you all have
>> some WTFs, else I've have to go try to drown myself in a pint of
>> Guinness :)
> There was one time when we tried to explain the value of using bit
> fields to a very junior developer. We had explained that if you had a
> lot of related boolean flags, instead of creating booleans for each,
> you can represent the values with the individual bits of an integer.
> Someone made the unfortunate comment of thinking about things as just
> being a sequence of 1's and 0's where 1 represented true and 0
> represented false.
> Well, later we see some of the code where our very junior developer
> had used this strategy. All of the code was written in Java, by the
> way. We did not find any integer declarations or bit shifting or
> anything like that. Instead we find a String where the value of the
> string itself was a sequence of the characters "0" and "1". Then to
> access a particular value, our developer was pulling out an individual
> character from the string and then doing a string compare operation
> against the String "1".
> We're just glad that we found this bit of Java wizardry early on. I
> think all of us were just shaking our heads at that one.
Wow. I've seen some bad java, but wow. That's a good one.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (GNU/Linux)
-----END PGP SIGNATURE-----
More information about the SATLUG