• JM (unregistered)

    This comment is empty.

  • PJ (unregistered)

    Real WTF is Using Access and excel for such a large data (50,000 people's record)

  • DOA (cs)

    You know, you could have stopped this story at the end of the second paragraph and it would still be front page material.

  • Rockafellow (unregistered)
    ...about all the (over 50,000) employees...

    Wow, that's OVER 9,000!

  • Capt. Oblivious (unregistered)

    I saw code this bad on slashdot yesterday.

    http://slashdot.org/comments.pl?sid=1080033&cid=26325951

    captcha: abigo(ne)?

  • Osno (unregistered)

    I love the way he cleans up the variables after using them. That's just cute.

  • Wyrd (unregistered)

    The Real Problem with, well basically all, computer programming is that the set of ways that you can do it wrong is far greater of the set of ways to do it right.

    Except I'm not sure if that applies to Python. I haven't used it myself. I know it's possible to do wtf's in it if you actually try, but the hype always said that Python makes programming easy, so maybe it's harder to accidentally produce bad code in it?

    -- Furry cows moo and decompress.

  • Sprite_tm (unregistered)

    Perhaps the guy is Dutch? Dutch 'teller' is English 'counter'.

  • ubersoldat (cs)

    My doctor told me to stay away from VB stuff... Actually, he told me to stay away from shit, because I'm allergic or something. Anyway, any one kind enough to dissect all that Microsoftish gibberish?

  • Rockafellow (unregistered) in reply to Sprite_tm
    Sprite_tm:
    Perhaps the guy is Dutch? Dutch 'teller' is English 'counter'.
    The variable name is not the WTF. The WTF is the clunky, unwieldy, implementation that includes redundant operations. Much easier would have been to declare a range and then:
    RangeIsEmpty = (WorksheetFunction.CountA(SourceRange) = 0)
    Courtesy ewbi.develops via Google.
  • configurator (unregistered)
    private bool Row_Is_Empty(long iRowNr, object lLastCol, Worksheet sh)
    {
       bool tempRow_Is_Empty = false;
       int j = 0;
       bool is_empty = false;
       int teller = 0;
       teller = 0;
       string curr_cell = null;
    
       for (j = 1; j <= llastcol;="" j++)="" {="" curr_cell="sh.Cells(iRowNr," j).@value.replace("\n",="" "").trim('="" ');="" if="" (curr_cell="" !="Microsoft.VisualBasic.Constants.vbNullString)" {="" teller="teller" +="" 1;="" }="" else="" {="" teller="teller;" }="" }="" if="" (teller="=" 0)="" {="" is_empty="true;" }="" else="" {="" is_empty="false;" }="" teller="0;" if="" (is_empty="=" true)="" {="" temprow_is_empty="is_empty;" }="" else="" {="" temprow_is_empty="false;" }="" is_empty="false;" teller="0;" return="" temprow_is_empty;="" }=""></=>

    Autocoverted with a tool

  • Cantabrigian (cs) in reply to Osno
    Osno:
    I love the way he cleans up the variables after using them. That's just cute.

    Especially the way he sets teller = 0 twice - just to make absolutely sure...

  • Anon (unregistered) in reply to configurator
    configurator:
    [code] Autocoverted with a tool

    Actually, I think the original was written by a tool!

    I always like to make sure when I'm checking if something is empty and find something, to keep checking just in case.

  • Anon (unregistered) in reply to Wyrd
    Wyrd:
    I know it's possible to do wtf's in it if you actually try, but the hype always said that Python makes programming easy, so maybe it's harder to *accidentally* produce bad code in it?

    I've not used Python either, but usually anything that makes coding "easier" makes producing bad code "easier" too!

    (see also: Visual Basic).

  • mbv (unregistered) in reply to Rockafellow
    Rockafellow:
    Sprite_tm:
    Perhaps the guy is Dutch? Dutch 'teller' is English 'counter'.
    The variable name is not the WTF. The WTF is the clunky, unwieldy, implementation that includes redundant operations. Much easier would have been to declare a range and then:
    RangeIsEmpty = (WorksheetFunction.CountA(SourceRange) = 0)
    Courtesy ewbi.develops via Google.
    Well, it limits the number of companies that can be mentioned here to 5, and I've heard a similar story for a Dutch bank. They used Access for a database, which grew too big, so performance got rather slow. Someone I know was involved in their upgrade to some standard software (probably SAP).
  • Josh (unregistered) in reply to Wyrd
    Wyrd:
    ...but the hype always said that Python makes programming easy, so maybe it's harder to *accidentally* produce bad code in it?

    You know, that's one thing I've never seen: a Python WTF. Anyone care to share? I'd pony up a $10 reward for Python WTF's but I'm too cheap.

  • Mcoder (cs) in reply to Osno
    Osno:
    I love the way he cleans up the variables after using them. That's just cute.
    Yeah, I love the way he cleans INTEGER variables too...

    @ubersoldat The function verify if there is any null field at a given row of a recordset. It also catches white space, I don't know if it is by design.

    It is implemented this way: It converts the recordset into a worksheet (don't know if it consumes time, but it is Microsoft, so probably does), access all the strings on the wanted row of the worksheet and count the number of times the empty string appears.

    Then, if the counter is zero, set a flag. Following, it goes into the well known pattern if(boolean = true) then another_boolean = true else another_boolean=false and returns another_boolean.

    Of course, during that time, he goes out of the way to flag the compiler that it can free an integer variable it (didn't) allocated, and may have commited a hole lot of sins that I can't see because I'm not a VB developer.

  • Bob (unregistered) in reply to Josh

    Looks like a neat python WTF: http://www.pirnat.com/mike/2008/11/25/python-youre-doing-it-wrong/

  • greg (unregistered)

    The only way it's completely wrong is if there is an API function to check a row if it is empty. Is there?

  • SomeCoder (unregistered) in reply to Josh
    Josh:
    Wyrd:
    ...but the hype always said that Python makes programming easy, so maybe it's harder to *accidentally* produce bad code in it?

    You know, that's one thing I've never seen: a Python WTF. Anyone care to share? I'd pony up a $10 reward for Python WTF's but I'm too cheap.

    Hmmm.. too bad I don't still have access to the monstrosity that was the Python script I had to deal with at one of my previous employers. It was one of those self aware scripts that rewrote pieces of itself to ensure that it was always running the latest version... or something. Not sure I ever found out the real reason for it.

    Anyway, the thing was about 15,000 lines long to do something that could have been done in maybe a 500 line Perl script. Hell, maybe even 500 lines in Python if the original programmer had not insisted on being so "clever" and using a lot of unnecessary Python tricks in his code. Basically it was way over engineered.

    Don't tell me you can't write WTFs in Python. You can write WTFs in any language. :)

  • Waffle (unregistered)

    Well, I'm the submitter of this ... thing, and yea it's really as bad as it sounds.

    The Real WTF (tm) is of course that their central HR repository was managed through Excel and Access by people who were, well... HR professionals. Behind that was naturally a very slow and rigid IT service that basically sent them to hell when they saw their requirements (some silly ones, some quite reasonable ones) for the database. Therefore, "Rob" figured it would be easier to keep full control while at the same time giving him the occasion to practice his guru-skillz.

    I doubt that the codebase was Tool-generated... and through various methods in the many related tools, I could see Rob had learnt new (and sometimes hilarious) programming techniques and tested them on "this and that piece o' software".

    This couldn't be complete without the fact that the people running this terrible process actually found it decent and were reticent to changing it because, well... the guy who had designed it was an IT wizard, after all.

    For those wondering, it was a Belgo-Dutch bankinsurer (notice the use of the past tense).

  • audax (unregistered) in reply to Josh

    http://forums.thedailywtf.com/forums/t/7522.aspx http://forums.thedailywtf.com/forums/p/8806/166686.aspx#166686 http://forums.thedailywtf.com/forums/p/10340/183784.aspx#183784

    Just to name a few...

  • anonymous_coder() (unregistered) in reply to Josh
    Josh:
    Wyrd:
    ...but the hype always said that Python makes programming easy, so maybe it's harder to *accidentally* produce bad code in it?

    You know, that's one thing I've never seen: a Python WTF. Anyone care to share? I'd pony up a $10 reward for Python WTF's but I'm too cheap.

    Dig into some of the older parts of Plone, and you can find some WTFs. Not "I'm too stupid to be a programmer" type, but "There are three people on earth who understand what this chunk of code does, and you aren't one of them" type WTFs. Implementing Java-style interfaces in Python. XML used to configure those interfaces. Two completely different templating languages. And an ACL-based security model that defines complex.

    It takes a long time to build up enough knowledge to become proficient in Plone...

  • Morry (unregistered)

    NOT a WTF. This is a good thing. Anything that keeps HR from screwing things up is a good thing.

  • DaveK (cs) in reply to Josh
    Josh:
    Wyrd:
    ...but the hype always said that Python makes programming easy, so maybe it's harder to *accidentally* produce bad code in it?

    You know, that's one thing I've never seen: a Python WTF. Anyone care to share? I'd pony up a $10 reward for Python WTF's but I'm too cheap.

    Python WTFs? No problem. Try figuring out where the control flow is supposed to go in a bunch of nested IFs when some @#!$% has gone and mixed TABs with spaces for indentation!

    I had another one that I can't quite remember the details of now, something to do with shifting an integer left and it suddenly turning into a long int and either a) not turning negative as I had expected when I OR'd in 0x80000000, and/or b) throwing an exception when I tried to mask it by ANDing with an integer value. Don't quite remember the exact details any more, but it was a WTF moment for me when I finally figured out that the type of the result of an operator could vary according to the particular integer values it was applied to.

  • Morry (unregistered)

    (screwing things up for the employee)

  • Procedural (unregistered)

    One thing that annoys me with the way the story is told is this: obviously this is an old institution. Some guy (Rob) has the foresight to replace what must have taken a whole cadre of employees a large chunk of time to do manually or on outdated equipment and makes it so that it can be done with comparatively minimal staff. He's no programmer (he says that doing VB is a hobby), he's an HR guy with competencies beyond those of the typical HR person. Good for him. Great for the company too.

    The system works better than the older one but is still suboptimal and does not scale. So they hire a consultant to make it snappy, and that pompous ass shows up, laughs at what was done, dumps on the other guy, and fails to realize that the problem is relatively small: if Rob hadn't been there, it wouldn't be one consultant showing up to fix it; it would have been a whole team. So a non-programmer doesn't know how to return a boolean in the most effective way ? So freaking what. He probably saved his employer a lot more than the wages he ever took in (and was probably not paid that much more about the baseline HR salary to come up with that).

    Ten years from now, some schmo will show up thinking he is God's gift to computing sciences, and will see that whoever was that idiotic consultant, he made a few mistakes: he designed stuff that obviously wouldn't scale well on quantum processors (the idiot !), relies on MS SQL (which by now is an embeddable component barely good enough to hold the temperature history in my thermostat), and did ridiculous code that relied on procedural programming rather than intentional declarations (what a twit ! And they paid that guy money !).

    The funny part of the story is that consultant's deficient thought processes.

  • Steenbergh (unregistered)

    I know who you mean. I'm there now. Herman and Thom say Hi. I'm maintaining an ASP-based self-service HR application older than me. I could start my own WTF website with the crap I find here...

  • Procedural (unregistered) in reply to Procedural

    "about the baseline HR" => "above the baseline HR"

  • Procedural (unregistered) in reply to configurator

    Converting it to C-sharp is not a significant improvement.

  • I walked the dinosaur (unregistered) in reply to Rockafellow

    What??? Over 9000?

  • convicted felon (unregistered)

    By the end of that show, they're into the millions. Super Saiyans for the win.

  • Bobble (unregistered) in reply to Wyrd

    There are many other trades/industries that come to mind that are the same way - off the top of my head: Construction, Law Enforcement, Food Service.

    Come to think of it, every industry is like this.

  • MisterCheese (unregistered) in reply to Procedural

    Thought it was C-pound?

  • AnonCoward23 (unregistered) in reply to Sprite_tm
    Sprite_tm:
    Perhaps the guy is Dutch? Dutch 'teller' is English 'counter'.
    Or maybe he's German. German 'teller' is English 'plate'. :)
  • Wongo (unregistered)

    In American, Teller = !Penn. Five of clubs anyone ?

  • lolwtf (cs) in reply to MisterCheese

    It's C-Tic-Tac-Toe.

    Also: "every month... This song and dance took 2 people a week to accomplish. [...] then go to step 1 and repeat the process for the "final" version." You call it a WTF, I call it job security.

  • hamBone (cs)

    I am far from a VB guru, but what in the name of binary is the teller=teller line about?

  • halcyon1234 (cs) in reply to lolwtf

    Doing automated checks manually may take up 2 manweeks, but it saves a lot of cycles on the CPUmatron. Those things are VALUABLE!

  • Daniel (unregistered)

    This hurt my eyes.

    God, you could pick any paragraph after the first, and it would still be a WTF.

  • Been there done that (unregistered)

    These situations invariably develop as a result of business needs being ignored by a stale or incompetent IT department leaving guys like "Rob down in HR" to solve the problem on his own, perhaps inelegantly, but solved nonetheless.

  • Anon (unregistered) in reply to Morry
    Morry:
    NOT a WTF. This is a good thing. Anything that keeps HR from screwing things up is a good thing.

    Good point. If HR weren't busy dealing with this crap, who knows what kind of hijinks they'd be up to.

  • ElPolloDiablo (unregistered) in reply to Waffle
    Waffle:
    Well, I'm the submitter of this ... thing, and yea it's really as bad as it sounds.

    ...

    For those wondering, it was a Belgo-Dutch bankinsurer (notice the use of the past tense).

    Hmmm, does the name start with an F ? Would explain a lot tho if that's the case...

    In any case, welcome to the wonderful world of financial instution's software, I always say.

  • Voodoo Coder (cs) in reply to greg
    greg:
    The only way it's _completely_ wrong is if there is an API function to check a row if it is empty. Is there?

    I haven't written VBA since my early, pre-professional days...but I know that there are several ways to accomplish what this does, without being a complete knucklehead. Here's a 3 line solution that checks the first row:

    If WorksheetFunction.CountA(Range("1:1")) = 0 Then

     rowIsEmpty = True
    

    End If

    You can break it down from there, and see that it wouldn't be rocket science to throw the entire sheet into it. You can also use things like xlUp and xlDown to determine the start and end of content.

    Or, you can abandon VBA for any solution beyond making simple for-your-use-only macros.

  • Bobbo (unregistered) in reply to AnonCoward23
    AnonCoward23:
    Sprite_tm:
    Perhaps the guy is Dutch? Dutch 'teller' is English 'counter'.
    Or maybe he's German. German 'teller' is English 'plate'. :)

    Or maybe he was a fan of Penn and Teller?

  • Bobbo (unregistered) in reply to Bobbo
    Bobbo:
    AnonCoward23:
    Sprite_tm:
    Perhaps the guy is Dutch? Dutch 'teller' is English 'counter'.
    Or maybe he's German. German 'teller' is English 'plate'. :)

    Or maybe he was a fan of Penn and Teller?

    Whoops, I've just noticed this has been done. That'll teach me to nip to the shops before replying to the 'last' post without refreshing!

  • Tom (unregistered) in reply to hamBone
    hamBone:
    I am far from a VB guru, but what in the name of binary is the teller=teller line about?
    It was running on a symmetrical multiprocessor. You need the same number of instructions on both branches of an "if" statement, to maintain symmetry.
  • wintermute (unregistered) in reply to MisterCheese
    MisterCheese:
    Thought it was C-pound?
    C£?

    That makes no sense.

  • weirded verber (unregistered)

    yes... c-pound. I like C-Pound for the error handling

  • Code Dependent (cs) in reply to Voodoo Coder
    Voodoo Coder:
    Here's a 3 line solution that checks the first row:

    If WorksheetFunction.CountA(Range("1:1")) = 0 Then

     rowIsEmpty = True
    

    End If

    Why even bother with the If statement?

    rowIsEmpty = (WorksheetFunction.CountA(Range("1:1")) = 0)

Leave a comment on “Enterprise Level Access”

Log In or post as a guest

Replying to comment #:

« Return to Article