• apaq11 (unregistered)

    wow that is really something to be proud of right there.

  • Seltsam (unregistered)

    It's enterprisey!

  • (cs) in reply to Seltsam

    Sounds like LOC to me.........

  • no name (unregistered)

    Some one got paid by the line.

    I hope....

  • jb (unregistered)

    At least it's well-commented!

  • (cs)

    Holy crap! Is this some kind of joke? This is beyond brillant levels of productivity. How did this happen?

  • Morthy (unregistered) in reply to jb
    Anonymous:
    At least it's well-commented!

    True that!

    I bet its done by pay per line.

  • (cs)

    OK then. I guess it was a slow day at the office and David's colleague felt the need to spend the entire day reinventing the wheel.
    Also is funny how he feels the need to have 20 character long constants to represent the numbers 1, 2, 3 and 4.
    What happens if the binary number has more than 4 bits?
    I guess this function wouldn't work eh...
    I cannot immediately detect any logic errors in this so I guess he should be congratulated for at least reinventing the wheel without creating any fatal flaws in the application.
    Also, I doesn't look like this was really 5000 lines of actual code. There are a lot of lines being taken up by useless comments and a lot of whitespace. This probably could've been done with only 1000 lines of code.

    This one is a little bit of a letdown compared to the highly entertaining WTFs of the past 2 weeks.

  • Maxim (unregistered)

    Brilliant!

    Well... not really... he actually did 5000 LOC

    what about being paid per lines?

  • (cs)

    If only Java had provided a way to loop, he wouldn't have been forced to do it with nothing but if statements.


    OH WAIT, IT DOES HAVE LOOPS! 

  • (cs)

    i bet I could do it faster by hand than this code ... where the heck was the manager ... hmm maybe he was the manager and thought he was the best programmer in the world ..

    oh well, I hope this programmer was given the old yeller for this hideous creation

  • toxik (unregistered) in reply to no name

    Someone wasn't too pleased to get fired I guess :P

  • (cs)

    It's difficult to type a response when your eyes have melted out of your head from looking at code like that.

    Good thing it's Friday.  I have all weekend to recuperate.


  • (cs) in reply to lizardfoot

    <font size="2">Deal Lord in Heaven.  At least it's nicely commented.  I especially like how he keeps referring to "an hexadecimal".  When did the 'h' become silent?

    </font>

  • (cs) in reply to cconroy

    <font size="2">Er, that would be "Dear Lord", of course.

    </font>

  • (cs)
    Alex Papadimoulis:
      /**
       * The number of hexadecimal characters per byte.
       */
      public static final int NUMBER_OF_HEXADECIMAL_CHARACTERS_PER_BYTE = 2;
    


    This is my favorite line.  So descriptive, not only in name, but also in documentation. 


    /**
     * this is the value which helps us determine the radius of a circle
     */
    public static final int VALUE_THAT_HELPS_US_DETERMINE_THE_RADIUS_OF_A_CIRCLE = 3.14;

  • Damn Yank (unregistered) in reply to cconroy

    This must be cockney code!

  • Burning Eyes (unregistered) in reply to lizardfoot

    <font size="2"><font size="1">public static final String HEX_CHARS = "0123456789ABCDEF";
    public char convertBitsToHexadecimalCharacter(boolean bit1,boolean bit2,boolean bit3,boolean bit4) {
       return HEX_CHARS.charAt((bit1?8:0)+(bit2?4:0)+(bit3?2:0)+(bit4?1:0));
    }</font>

    Oh forgive me, I had to write this to fix my eyes...
    </font>

  • (cs)

    I want to see his Octal class.

  • (cs) in reply to lizardfoot
    lizardfoot:
    It's difficult to type a response when your eyes have melted out of your head from looking at code like that.

    Good thing it's Friday.  I have all weekend to recuperate.




    The tears from my laughter just shorted out my keyboard.  I had to get a new one.
  • (cs) in reply to cconroy
    cconroy:
    <font size="2">Deal Lord in Heaven.  At least it's nicely commented.  I especially like how he keeps referring to "an hexadecimal".  When did the 'h' become silent?

    </font>


    I think that is proper British english.  I'm not 100% sure, but I know I have see "an" in front of 'h' words quite a bit when reading british articles and literature.  Older english literature especially.
  • (cs) in reply to lizardfoot
    lizardfoot:
    Alex Papadimoulis:
      /**
    * The number of hexadecimal characters per byte.
    */
    public static final int NUMBER_OF_HEXADECIMAL_CHARACTERS_PER_BYTE = 2;



    This is my favorite line.  So descriptive, not only in name, but also in documentation. 


    /**
     * this is the value which helps us determine the radius of a circle
     */
    public static final int VALUE_THAT_HELPS_US_DETERMINE_THE_RADIUS_OF_A_CIRCLE = 3.14;



    I remember Eclipse's auto-generated comments looking like this....  After all, if one has to write 5000 lines of meaningless code like this, it helps to save some time by having your IDE generate your comments for you :)
  • (cs)

    My personal favorite is

    static final Char[] hexChars="0123456789ABCDEF".getChars(); char toHex(int val) { return hexChars[val&0xF]; }

    and then use varieties of it in a loop to convert however many you need

    though of course Java provides String Integer.toString(int value, int radix);

    (and no, I'm not going to use IE just so I can add formatting to this)

  • meh (unregistered) in reply to cconroy

    about 'an hour' ago.  :p

  • (cs) in reply to SilverDirk

    Oh, and in C its even more fun

    char toHex(int val) { return "0123456789ABCDEF"[val&0xF]; }

  • (cs)

    There is a first time for everything.  And today is the first time I feel I must claim that this WTF must be made up.

    We are getting close to April 1, after all.

    I've seen many people re-implement functionality Java already provides because they think they can do it better.  I've seen it so many times I've practically memorized the tirade I give them at code reviews.

    But this... this is so above and beyond the call of "I'd rather do it my way" that I just can't imagine anyone sleeping at night after writing it.

    I can, however, imagine that whoever wrote it went on a campaign to try to get everyone else on the team to use it wherever the need to convert bytes to hex strings arose.  Bad frameworks are as common as fungus and about as resistant to being cleaned up.

  • (cs) in reply to jb
    Anonymous:
    At least it's well-commented!


    He forgot the *hiccup* notations to indicate his drunkenness.
  • Cassandra (unregistered) in reply to meh

    oh my hat that hurt.  It burns!

  • bcammack (unregistered)

    I can't help but feel that this is an example of how a person can be intelligent and educated regarding computers and programming, but doesn't have that creative "something" that makes a truly good programmer.   Yeah, it compiles and yeah, it works, but...

    I liken it to somebody who really, really wants to play the guitar, but doesn't have a lick of innate creative capacity for it.  They can practice their brains out for years, but never be more than an ordinary hack.   I've seen this before.  My cousin is/was a musical virtuoso who could play practically any instrument you handed him extremely well.  My older brother, OTOH, loves music dearly and has practiced and played the guitar for over four decades, yet is, to put it charitably, "adequate" at it.

  • (cs) in reply to cconroy
    cconroy:
    cconroy:
    <font size="2">Deal Lord in Heaven.  At least it's nicely commented.  I especially like how he keeps referring to "an hexadecimal".  When did the 'h' become silent?

    </font>
    <font size="2">Er, that would be "Dear Lord", of course.

    </font>

    Oh, I thought you were talking about the Patron Saint of Car Salesmen.
  • (cs) in reply to cconroy
    cconroy:
    <font size="2">Er, that would be "Dear Lord", of course.

    </font>


    Oh, I thought you were referring to ebay.
  • nitpick (unregistered) in reply to cconroy
    cconroy:
    <font size="2">Deal Lord in Heaven.  At least it's nicely commented.  I especially like how he keeps referring to "an hexadecimal".  When did the 'h' become silent?</font>

    cconroy:
    Er, that would be "Dear Lord", of course.

    lol
  • (cs)

    Looks like the work of a person who didn't know anything about Programming, sat through two lectures of Haskell, and never quite got hang of these Leet Advanced Features...

    There's functional programming and then there's functional functional programming.

  • (cs)
    Alex Papadimoulis:

      /**
       * The '1' hexidecimal character.
       */

      public static final char ONE = '1';

     
    mmmm k, thx.
     
    [:D][:D][:D]
  • (cs) in reply to VGR
    VGR:
    There is a first time for everything.  And today is the first time I feel I must claim that this WTF must be made up.

    We are getting close to April 1, after all.

    I've seen many people re-implement functionality Java already provides because they think they can do it better.  I've seen it so many times I've practically memorized the tirade I give them at code reviews.

    But this... this is so above and beyond the call of "I'd rather do it my way" that I just can't imagine anyone sleeping at night after writing it.

    I can, however, imagine that whoever wrote it went on a campaign to try to get everyone else on the team to use it wherever the need to convert bytes to hex strings arose.  Bad frameworks are as common as fungus and about as resistant to being cleaned up.

    Yes, and surely not by reusing the code.  Instead it should be copy-pasted everywhere it's needed.

    More effecient to do it in-line, you know.
  • (cs)

    This looks like a practical joke from an unfortunate programmer whose performance is measured in LOC per day and who is tortured with overly strict requirements regarding comments, constants etc.

  • (cs)

    For whatever it's worth, this is what I did once...

    #ifndef ASM_HEXIFY
       const char hexchars[] = {48,49,50,51,52,53,54,55,56,57,1,2,3,4,5,6};
    #  define hex_low(what) (hexchars[((what) & 0x0F)])
    #  define hex_hi(what) (hexchars[(((what) & 0xF0) >> 4)])
    #else
    #  define hex_low(what) hex_low_asm(what)
    #  define hex_hi(what) hex_hi_asm(what)
    #endif

    ...and before you complain about the character values, remember that all the world is not ASCII. =(

    The assembler version of these routines sucked for some reason or other...


  • Valdas (unregistered)

    Hey, I've spotted another WTF: they did not declare constants for lowercase numbers ;)

    public static final char lower_1 = '1';

    That would be priceless.. Also, more LOCs.

  • (cs) in reply to Burning Eyes

    Something wrong with String.toHexString(int i)?

  • (cs)
    Alex Papadimoulis:

      public static final int NUMBER_OF_HEXADECIMAL_CHARACTERS_PER_BYTE = 2;

    hey!!... truth is how you define it

    besides, this makes it really scalable

  • (cs)

    If he gets paid by the line I hope none of his future employers see this code.  Boy what a waste of time.  Can you imagine the frustration he must have had when someone pointed out that he just has reinvented the wheel? 

  • Mike (unregistered) in reply to Ytram

        Only if the next word starts with a vowel, or a silent consonant.  Eg: an apple, an hotel (if you don't pronounce the "h", as some people don't).

  • (cs)

    Today is a good example of how not to build enterprise class software. First, pick a language that is has a lot of hype around it such as java. Then, disregard all concern for performance, because we all know you can just through a faster machine at it. Finally, hire a skilled programmer and tell them that they will get paid by the number of lines of code they write, and that you expect them to comment every single line of code. The result will be a very slow, but easily maintainable piece of crap.

    The above example was most likely generated by a programmer that was paid by the number of lines of code he or she produced. The programmer then creates a program to output this code in oh, lets say about five hours to give him or her time to debug, surf the net, and just screw around... After done with the generater, the programmer runs it, and then sits around for the next week doing nothing because they were able to make a program that wrote 5000 lines of code that is clean, commented, and technically correct...

    Of course, we all know what we would have done had this project been our baby...

  • (cs)

    At 5000 lines of code, you would wind up with shorter code by writing:

    for(int a; a=0; a < array.length())
    {
      switch(array[a]) {
        case 0b00000001: ...
         ....
        case 0b11111111: ...
    }

    ...that would come to about 1000 lines. 1/5th the size for 256 times the stupidity.  Despite the absolute terribleness of this implementation, what bothers me more-so is the fact that an entire class has been designed and declared for such a trivial procedure. In terms of overhead to benefit, this one outsinks the titanic.

  • stephen (unregistered) in reply to cconroy
    cconroy:
    <font size="2">Deal Lord in Heaven.  At least it's nicely commented.  I especially like how he keeps referring to "an hexadecimal".  When did the 'h' become silent?

    </font>


    Maybe he's french.
  • (cs) in reply to lizardfoot
    lizardfoot:
    Alex Papadimoulis:
      /**
       * The number of hexadecimal characters per byte.
       */
      public static final int NUMBER_OF_HEXADECIMAL_CHARACTERS_PER_BYTE = 2;
    



    This is my favorite line.  So descriptive, not only in name, but also in documentation. 


    /**
     * this is the value which helps us determine the radius of a circle
     */
    public static final int VALUE_THAT_HELPS_US_DETERMINE_THE_RADIUS_OF_A_CIRCLE = 3.14;

    OMG I am not sure which I am laughing harder at..the WTF or this comment.

  • hem (unregistered) in reply to GoatCheez

    Guys, I'm putting this gem into my library of reusable code. Someday this piece will save my life.

  • (cs) in reply to Ytram

    Ytram:
    cconroy:
    <FONT size=2>Deal Lord in Heaven.  At least it's nicely commented.  I especially like how he keeps referring to "an hexadecimal".  When did the 'h' become silent?

    </FONT>


    I think that is proper British english.  I'm not 100% sure, but I know I have see "an" in front of 'h' words quite a bit when reading british articles and literature.  Older english literature especially.

    Maybe he was speaking in pirate.  "An 'exidecimal is upon us, ye lads.  Hard to port!" 

    Maybe not...it was funny in my head though.

  • PresidentBeef (unregistered) in reply to Ytram
    Ytram:
    cconroy:
    <font size="2">Deal Lord in Heaven.  At least it's nicely commented.  I especially like how he keeps referring to "an hexadecimal".  When did the 'h' become silent?

    </font>


    I think that is proper British english.  I'm not 100% sure, but I know I have see "an" in front of 'h' words quite a bit when reading british articles and literature.  Older english literature especially.



    The rule is, use 'an' if it makes a vowel sound. So, 'an hour' (sounds like 'our'), but 'a horse'.

    But I don't think 'hexadecimal' starts with a vowel sound, so the original point stands.
  • (cs) in reply to Ytram
    Ytram:

    I think that is proper British english.  I'm not 100% sure, but I know I have see "an" in front of 'h' words quite a bit when reading british articles and literature.

    Nope.  Modern British follows the same rules as American (i.e. you go by the pronunciation, "an hour" but "a hotel").  Traditionally there was a rule that where a word began with "h" and the first syllable was unaccented, then you'd write "an", so "a hospital" but "an hotel", but that is now obsolete and only used by the stuffiest pedants.  No literate Briton ever wrote "an hospital".

    As for the WTF... to think I was joking when I posted something vaguely similar in the other thread!  (Though, to be fair, this is a billion times worse than my version...)

Leave a comment on “To the Hexth Degree”

Log In or post as a guest

Replying to comment #65622:

« Return to Article