• Busa (unregistered)

    This isn't uncommon, even in production systems.

    I know a guy who knows a guy (muaha) who works for a major Credit Processing company.  They run records for all the major bureaus.  The original code is Perl and C, with Java bootstrapped in.

    The main bureau who funded the founding of this Company tried to take it over, stating that the Company, along with the code it developed, belonged to the bureau.

    Apparently the president (who was the dude who wrote the original core) wasn't worried.  The code was so kludgy that there was no hope for the bureau to manage it.

    Most software in large companies grows very... organically. Hack here, hack there... soon the thing is just a bunch of lines of code that somehow manage to form a program.

  • Busa (unregistered) in reply to kierenj

    You're assuming it's a built-in hash.  Could be something they coded up.

  • (cs)

    Anyone who thinks this is bad is clueless.  This is the optimal Enterprise Solution.  Obviously this developer was more concerned with the cost of developing a solution that forced a redesign of the Enterprise Software, so he used the existing tools available to get what he needed.  Weighing the decision of development time vs. performance and stability is important in an Enterprise Solution.

    The Quality of this Enterprise Software is incredible.  It's well documented, unlike some other "Enterprise" solutions we've seen recently.  That means it will reduce costs of future maintenance when the Enterprise must warp itself to a new business sector!

    Really, this isn't so bad.  A little runtime performance in return for well documented Enterprise code that obvioiusly cost very little (he didn't even work overtime!) to implement.

  • Kopite (unregistered) in reply to Jian

    Jian:
    Don't get me wrong. I don't think that what this developer did was correct in any way shape or form. Performing a hack versus debugging and fixing the source code, is never the best option. He could however have hid it from the people required to maintain the source code at a later date. That being covered, I find it quite humorous that half the people in here didn't even know this was C++ from the start. Yet they have the wherewithal to call others morons. I believe this is the real WTF.

    No, thats not a WFT at all.  Not every programmer can or should know every syntax for every language to know which programming practices are good and which are pure evil. 

    In fact, with respect, your statement is a WTF as you are confusing 2 very different things:  computer syntax and computer practice.  The first is particular to a language; the second is general across the profession.  It would not bother me in the slightest if someone in my team did not recognise which actual language this snippet is written in (unless, of course, they are C++ or C# programmers - in the former case they should recognise their language; in the latter case they should realise its not their language).  It would, however, be a cause of grave concern if someone in my team did not immediately realise that what this "programmer" tried to do was an incredibly stupid language-independent thing to try to do (made worse still by the multiple errors in implementation).

    Hope I've not caused any offence.

  • (cs) in reply to Jake
    Anonymous:
    ParkinT:

    <font color="#008200">I was honestly planning on removing this tomorrow,</font>

    <font color="#008200">

    </font>

    <font color="#000000">Obviously, it did not get removed.  So, was this programmer psychic?  I see this as a "sort of" message-in-a-bottle, let loose for someone to discover one day far in the future (hopefully, after he/she has left the organization)</font>

    I was thinking the same thing.  Look at this again:

    <font color="#008200">This is bad. Reaaly bad. It's a really, really bad hack. If you're an employee of Intertrode Communication, then I'm really, really sorry that you have to maintain this. I was honestly planning on removing this tomorrow...
    </font>

    <font color="#008200">He knew he was planning to leave it in.</font>



    Not necessarily - he knew there was a chance that he might leave it in, but if he fixed it, he'd remove the comment.

    A bit like one of those "leave a letter with the lawyer who will open it if I don't return from visiting my ex-wife" ;)
  • (cs) in reply to Busa
    Anonymous:
    This isn't uncommon, even in production systems.

    I know a guy who knows a guy (muaha) who works for a major Credit Processing company.  They run records for all the major bureaus.  The original code is Perl and C, with Java bootstrapped in.

    The main bureau who funded the founding of this Company tried to take it over, stating that the Company, along with the code it developed, belonged to the bureau.

    Apparently the president (who was the dude who wrote the original core) wasn't worried.  The code was so kludgy that there was no hope for the bureau to manage it.

    Most software in large companies grows very... organically. Hack here, hack there... soon the thing is just a bunch of lines of code that somehow manage to form a program.



    Ah, yes.  The Big Ball of Mud.  For those who haven't already read about it:  http://www.laputan.org/mud/

    Long, but educational.
  • (cs) in reply to Jeff S
    Jeff S:
    Can we *finally* after all these years of bickering unanimously agree that this is a great WTF ??

    A classic!  WTF++ !

    Have to agree, a very good one!
  • (cs) in reply to impslayer

    This is a great WFT to be sure.

    Logs as data, who'dathunkit

    but what baffles me is why the original programmer couldn't just find out where the log was being written and thus what mysterious algorithm came up with the accountId to be logged in the first place.

  • George (unregistered) in reply to jspenguin

    jspenguin:
    What language is that? It's not C, it's not Java, it's not VB, it's not Perl or PHP.

    C++

    (Someone else said C#, but C# has null as a lower-case keyword.)

     

  • plizak (unregistered) in reply to ParkinT

    ParkinT

     

    I notice your signature, and yes, I too have wondered why there is brail on the drive up ATMs.

    Reason:  Because they use a generic keypad. 

  • (cs) in reply to CornedBee
    CornedBee:

    It's not C# either - there's just no way you could get this to compile in C#. The null constant is lowercase in C#, and no other construct could be legally compared to both a string (AccountId) and a FileObject without casts.


    Disclaimer first: I'm not saying this is C#. I aggree with the majority that this is C++.
    That said, I think it's technically possible to have this as part of a C# programm that compiles.
    We do not know the class of AccountId, we do not know the FileHandle class, we do not know the class of NULL.
    By overriding the == operator and/or providing implicit conversions it should be possible to compile that stuff. Of course that doesn't mean it would do anything usefull.
  • Tragomaskhalos (unregistered)

    Was it really easier to (a) cruft together this log-scraping garbage AND (b) write a long rambling apology about it than to simply FIX THE ORIGINAL PROBLEM ALREADY ?!

     

  • (cs) in reply to Damian
    Anonymous:
    Looks like Delphi.

    Are you on drugs? This is nothing like Delphi. (If it was Delphi, it would be great. The curly braces would mean that almost everything has been commented out.)

  • Rolf (unregistered) in reply to ParkinT
    ParkinT:
    I am *very* curious to know what the original problem was; and how simple it was to correct!


    I think changing (AccountId == "")  to (AccountId.equals("")) would have fixed the problem

  • (cs)

    Apart from the technical evils, did anyone notice the programmer's self-imposed time frame for correcting the code?

    >I was honestly planning on removing this tomorrow

    When, exactly, does tomorrow come?

  • (cs) in reply to kierenj

    kierenj:
    ServerSession?  Doesn't exist in C#.  It's the name of a java interface.  The session is accessible through Session, the application through Application.  What would a server session be anyway?

    It has been a while but I am almost certain that ServerSession does exist in Borland C++ and I am absolutely sure that TString is a class in Borland C++

    This is Borland C++ and probably even done with Borland Builder.

  • (cs) in reply to Rank Amateur
    Rank Amateur:

    This whole problem could be so easily solved by reading the account ID from the user's screen using OCR.

    --Rank

    Or would that actually improve matters?



    Bah -- Just ask the user to type it in. Again. And again. And...
  • (cs) in reply to ammoQ
    ammoQ:
    Matt:
    Maybe that's why he thinks "AccountID" is not set.  He spelled ServerSesion wrong. Maybe if he spelled it ServerSession["AccountID"] he would have better luck and not need this code.  Just a thougt!

    I cannot think of a single programming language that defaults non-existing variables to empty maps indexed by strings.


    PERL! Do I win a prize?

    Example? Actual code, actually run:

    $  perl -e ' print "|" . $hashvar{NonExistentKey} . "|\n";'
    ||


  • (cs) in reply to WTF Batman
    WTF Batman:
    ammoQ:

    I cannot think of a single programming language that defaults non-existing variables to empty maps indexed by strings.


    PERL! Do I win a prize?


    No, because you are not the first one to point that out.

  • Dev (unregistered)

    I am a newbie programmer and I am trying to figure out the context of this code and what is wrong with it from the experts here. Could someone help by commenting on each line as to what is wrong with it. Sorry if this is not supposed to be asked here but I am trying to learn. Thanks

  • (cs) in reply to Dev
    Dev:
    I am a newbie programmer and I am trying to figure out the context of this code and what is wrong with it from the experts here. Could someone help by commenting on each line as to what is wrong with it. Sorry if this is not supposed to be asked here but I am trying to learn. Thanks


    The WTF is not how it is done but what is done. For some reason, at this point of the program, the program somehow forgot the AccountId and recovers that by reading through the log file. A very stupid way to work around a bug instead of fixing it.
  • (cs) in reply to ammoQ
    ammoQ:
    WTF Batman:
    ammoQ:

    I cannot think of a single programming language that defaults non-existing variables to empty maps indexed by strings.


    PERL! Do I win a prize?


    No, because you are not the first one to point that out.



    Ah, but I *was* the first to give an example. So THERE! :-P

    NOW do I get a prize? Maybe just a cookie?
  • BattleField 2 (unregistered)

    This code is from Battlefield 2

     I would know.
     I wrote it.

     I never did fix this problem or even know what is wrong..

     the Whole Battlefield 2 game is in debug mode
    we have some bugs in the release mode that stop it from running.

     so we just released the debug version.
     you can even download the obj files on the net.

  • (cs) in reply to WTF Batman

                          CERTIFICATE

    This certifies that

    WTF Batman                         
           2nd

    was the first one to point out that


    PERL defaults non-existing variables to empty maps indexed by strings but the first one who also gave an example

    March 23, 2006
    ammoQ

  • (cs) in reply to BattleField 2
    Anonymous:
    This code is from Battlefield 2

     I would know.
     I wrote it.

     I never did fix this problem or even know what is wrong..

     the Whole Battlefield 2 game is in debug mode
    we have some bugs in the release mode that stop it from running.

     so we just released the debug version.
     you can even download the obj files on the net.

    While I don't really believe this guy.  I will say it has happened before.
    Getting a .map or .pdb for game is like being a kid in a candy store!
    There isn't an easy way to put the genie back in the bottle either unless you refactor ALL of the code I can still solve new offsets based on it trivially.
    Then again, I can find whatever I want anyways... it just takes a lot more time/effort.
  • (cs) in reply to ammoQ
    ammoQ:

                          CERTIFICATE


    They love me! They REALLY *love* me! I shall love and cherish it always! I'd like to thank ammoQ for making this all possible, my agent, my parents (I love you Mom!), my cat, the goldfish...
  • sean (unregistered) in reply to tiktin

    he has to read th entire log file to get the LAST entry.

    sorry for defending that jerk ...

  • Gabriel (unregistered) in reply to ParkinT

    At least the code is thoroughly commented!!

    You know, I agree. Granted, it's a WTF that the code is even there, but I'm still impressed that the original (wtf)coder said WHY it was happening (e.g., "I have no ide why this isn't set properly already").

  • sean (unregistered) in reply to Alun Jones

    ...


    Anonymous:

    tiktin:
    Reads the entire log file, even after finding the account id? WTF?!

    Well, of course he does - after all, if he didn't read all the way through to the end, it might not close properly.




  • (cs)

    Well... At least he did not lie in his comments.

    I had a projct where I could not trust any of the comments.

    The first and only comment I read/trusted(my mistake) was: // We do no add this service's fee to the bill // since there is no such service in this case

    Guess...

  • Just Another WTF (unregistered) in reply to JAlexoid

    You know if he had just implemented a Developmestuction Environment(tm) he could have found the original bug an not had to write either the ugly bad code to parse the log file or the ugly bad apology to those who come after.

  • javaxman (unregistered)

    I would like to be probably the 100th person to say, simply, OMG.

    Actually OMG is an understatement. You'd really do this?

    Reading through a log file to find data rather than fixing an actual, serious bug in your code ? I need to go destroy something now. As someone who gives a crap about quality, and has actually worked at jobs where code review was part of the process, this makes my head tingle, it's so bad. The concept that this made it's way into a real, production system and survived even one release... so scary.

    I suppose it's nice that the guy actually commented this and was aware of how bad it is, but... being aware, did he talk to anyone else about it, or the core problem? Knowing how bad it is, why did he put it in ? Can we get a video of him pounding his head against a wall repeatedly? Please ?

  • Foo (unregistered)

    I'm so glad this is commented. That means we can easily identify this code as bubble gum over a hole in the hull of the titanic. At least we know that the hole is on the starboard now.

  • None Of The Above (unregistered) in reply to CornedBee

    CornedBee:

    It's not C# either - there's just no way you could get this to compile in C#. The null constant is lowercase in C#, and no other construct could be legally compared to both a string (AccountId) and a FileObject without casts.

    Nope. C# allows this Just Fine...

    object NULL = null;

    string AccountId = "whatever";

    if( AccountId == NULL ) { }

     

    (I don't know WTF someone would want to though...)

  • (cs) in reply to plizak
    Anonymous:

    ParkinT

     

    I notice your signature, and yes, I too have wondered why there is brail on the drive up ATMs.

    Reason:  Because they use a generic keypad. 

    Two other reasons: a blind person might be behind the driver, in the back seat (like in a taxi) - and/or - installing Braille keypads universally is probably simpler than trying to create exemptions from the Americans with Disabilities Act.

  • (cs) in reply to Jian

    Jian:
    Don't get me wrong. I don't think that what this developer did was correct in any way shape or form. Performing a hack versus debugging and fixing the source code, is never the best option. He could however have hid it from the people required to maintain the source code at a later date. That being covered, I find it quite humorous that half the people in here didn't even know this was C++ from the start. Yet they have the wherewithal to call others morons. I believe this is the real WTF.

    I find this quite humorous also. Here I am, a software developer with way too many years of experience, and I didn't recognize this code as C++ (a language I have never coded in, and only debugged once - 8 years ago). And yet, even though I couldn't identify the language, I still have the wherewithal to call others morons. WTF coders, inept fast-food workers, bumbling government drones, too many more to list - all morons.

    And why do I have the wherewithal to call these people morons? Because, even though I can't identify all programming languages by sight, I can code in a good many of them, and this ability provides me with a very good income. This wherewithal greatly increases the probability that I will never be looking to any of these lesser people for jobs or favors, and allows me the pleasure of spurning them.

    Oh - or perhaps you meant to write "(unmitigated) gall"?

    (Adding one more to the list.)

  • (cs) in reply to HatTrick
    HatTrick:

    kierenj:
    ServerSession?  Doesn't exist in C#.  It's the name of a java interface.  The session is accessible through Session, the application through Application.  What would a server session be anyway?

    It has been a while but I am almost certain that ServerSession does exist in Borland C++ and I am absolutely sure that TString is a class in Borland C++

    This is Borland C++ and probably even done with Borland Builder.

    Actually, while Borland Builder uses TClassName style to name all thier classes, their string class is called AnsiString. hehe.

    I have no idea why. But I'll go ahead and mention that the reason they have their own string class is to be binary-compatible with Delphi's strings.

    I'm going to bet the poster's orginization had developed a bunch of custom C++ back before the Standard Template Library became.. standard. That probably also explains their renamed file operation functions (maybe had to avoid a naming conflict? Maybe those are special ones that call the Windows CreateFile and ReadFile, but use the arguments of the classic unix versions?) and they probably also wrote their own map-ish thing for ServerSession.

  • Ben (unregistered)

    I hope this gets read. Yes, it's a huge WTF and funny because it's not in source I have to deal with... but, I think this highlights why it's important to have a culture within a dev team of talking about errors and bugs openly rather than sweeping them under the carpet (like this) for fear of losing respect, being judged, etc.. etc..

  • TomCo (unregistered)

    <FONT color=#800080>[grenade tossed in middle of discussion...]</FONT>

    [:P] WTF "coup de grâce" 3...2...1...

    <FONT color=#ff0000>   Do you think the log file contains XML?  Brillant! [:^)]</FONT>

    <FONT color=#800080>[...running for cover under closest cubicle!]</FONT>

     

  • Jian (unregistered) in reply to rbriem
    rbriem:

    I find this quite humorous also. Here I am, a software developer with way too many years of experience, and I didn't recognize this code as C++ (a language I have never coded in, and only debugged once - 8 years ago). And yet, even though I couldn't identify the language, I still have the wherewithal to call others morons. WTF coders, inept fast-food workers, bumbling government drones, too many more to list - all morons.

    And why do I have the wherewithal to call these people morons? Because, even though I can't identify all programming languages by sight, I can code in a good many of them, and this ability provides me with a very good income. This wherewithal greatly increases the probability that I will never be looking to any of these lesser people for jobs or favors, and allows me the pleasure of spurning them.

    Oh - or perhaps you meant to write "(unmitigated) gall"?

    (Adding one more to the list.)



    Ah yes. A language flame. I did indeed mean "gall" as it were. Interesting how you take the stance that because you make a better income than low-wage workers that you're somehow better than them. Even more interesting is how you take the stance that because you feel yourself superior, you have the right to call these people morons and look down upon them.

    I too have a good job designing and implementing software. I would wager that I have more experience than you, and more than likely more programming languages under my belt than you can count. My point however is that you are all so quick to judge (and perhaps this doesn't directly apply to you in particular), however half (or more) of you can't even do a cursory search on languages via google, and get a few source examples and reasonably identify a language.
  • Leonardo (unregistered) in reply to ParkinT

    Who cares which language that WTF is in! WTFs can be implemented in any language. Do you all not have anything better to do?

  • (cs) in reply to Leonardo
    Anonymous:
    Do you all not have anything better to do?

    You're joking, right? People are spending time here laughing about other peoples' WTFs :)
  • hq (unregistered) in reply to merreborn

    ???????????

    ??!!!!!!!!!!!!!!!!!!!!!!!!!!!

  • PixelMaster (unregistered)

    The guy will no longer cause any havoc on the floor, he was promoted to management ...

  • (cs) in reply to R.Flowers
    R.Flowers:
    Anonymous:
    I notice your signature, and yes, I too have wondered why there is brail on the drive up ATMs.

    Reason:  Because they use a generic keypad

    Two other reasons: a blind person might be behind the driver, in the back seat (like in a taxi) - and/or - installing Braille keypads universally is probably simpler than trying to create exemptions from the Americans with Disabilities Act.

    All interesting, and they might have an element of truth. However they all miss the fact that the question assumes something that is not true. That is you cannot ask this question unless you assume that an ATM designed to be used from a car cannot be used in any other way. Have you ever seen an ATM with guards of some sort in place that prevent someone on foot from walking up to it?

    I know that more than once I have WALKED to my local drive up ATM to get my cash. (I once had a car where the windows did not work, so even when I drove to the machine I had to park and get out of the car to use it)

    While the positioning is not ideal for someone trying to use the machine on foot, I have never had a problem doing so.

  • (cs) in reply to hank miller
    hank miller:
    All interesting, and they might have an element of truth. However they all miss the fact that the question assumes something that is not true. That is you cannot ask this question unless you assume that an ATM designed to be used from a car cannot be used in any other way. Have you ever seen an ATM with guards of some sort in place that prevent someone on foot from walking up to it?

    I know that more than once I have WALKED to my local drive up ATM to get my cash. (I once had a car where the windows did not work, so even when I drove to the machine I had to park and get out of the car to use it)

    While the positioning is not ideal for someone trying to use the machine on foot, I have never had a problem doing so.



    On Fridays (when I bank), my bank closes the lobby at 5:30 PM and the drivethrough at 6:00 PM.  My usual Friday bus gets me back home at about 5:40 PM.

    Sincerely,

    Gene Wirchenko

  • (cs) in reply to Jian
    Anonymous:
    rbriem:

    I find this quite humorous also. Here I am, a software developer with way too many years of experience, and I didn't recognize this code as C++ (a language I have never coded in, and only debugged once - 8 years ago). And yet, even though I couldn't identify the language, I still have the wherewithal to call others morons. WTF coders, inept fast-food workers, bumbling government drones, too many more to list - all morons.

    And why do I have the wherewithal to call these people morons? Because, even though I can't identify all programming languages by sight, I can code in a good many of them, and this ability provides me with a very good income. This wherewithal greatly increases the probability that I will never be looking to any of these lesser people for jobs or favors, and allows me the pleasure of spurning them.

    Oh - or perhaps you meant to write "(unmitigated) gall"?

    (Adding one more to the list.)



    Ah yes. A language flame. I did indeed mean "gall" as it were. Interesting how you take the stance that because you make a better income than low-wage workers that you're somehow better than them. Even more interesting is how you take the stance that because you feel yourself superior, you have the right to call these people morons and look down upon them.

    I too have a good job designing and implementing software. I would wager that I have more experience than you, and more than likely more programming languages under my belt than you can count. My point however is that you are all so quick to judge (and perhaps this doesn't directly apply to you in particular), however half (or more) of you can't even do a cursory search on languages via google, and get a few source examples and reasonably identify a language.

    Interesting how you take my statement I consider that "WTF-coding, bumbling, inept [people] morons" and transform it into "low-wage workers are morons and therefore less than me". Many of the WTF coders I've seen here undoubtedly make more money than me, as do many "bumbling government drones" (not fast-food workers, though). I can, and do, look down upon ineptitude, and when I do something stupid, I deserve to be called on the carpet and ridiculed, too.

    My point is that it's unlikely that the inept people I call morons will ever have any significant influence in my life and I can write them off, partly because of my income.

    As for your experience? Possibly, and good for you. Language tally? Patently false.

    And quick judgement? You couldn't even search a dictionary site to clarify a word you didn't know how to use, and yet you take others to task for not Googling for programming languages? Pot - kettle, hence the flame.

  • cjb (unregistered)

    <font style="text-decoration: underline;" size="4">DAYUUUUUUUUUMMMMMMM! </font>

    This has got to be a joke, right?!?!?!?!?

  • (cs) in reply to cjb

    well I hope the company fails as misearbly as it can, for the lack of support it has shown to just one branch of operations

     

  • (cs)

    Ironic story: for our software engineering class we were writing a plugin for a java application.
    The application was buggy and hackish and the ironic part was that at the beginning of the semester the guy who wrote the app linked us to this article from the professor's website.
    So for the rest of the semester everywhere in the non-final version of our code we made references to this article and always apologized if anything was even remotely hackish.
    The prof seemed to enjoy it much!

Leave a comment on “The Apologetic Coder”

Log In or post as a guest

Replying to comment #:

« Return to Article