Enterprise Level Access

« Return to Article
  • JM 2009-01-05 09:13
    This comment is empty.
  • PJ 2009-01-05 09:22
    Real WTF is Using Access and excel for such a large data (50,000 people's record)
  • DOA 2009-01-05 09:23
    You know, you could have stopped this story at the end of the second paragraph and it would still be front page material.
  • Rockafellow 2009-01-05 09:33
    ...about all the (over 50,000) employees...


    Wow, that's OVER 9,000!
  • Capt. Oblivious 2009-01-05 09:34
    I saw code this bad on slashdot yesterday.

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

    captcha: abigo(ne)?
  • Osno 2009-01-05 09:34
    I love the way he cleans up the variables after using them. That's just cute.
  • Wyrd 2009-01-05 09:51
    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 2009-01-05 10:12
    Perhaps the guy is Dutch? Dutch 'teller' is English 'counter'.
  • ubersoldat 2009-01-05 10:17
    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 2009-01-05 10:24
    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 2009-01-05 10:25

    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 2009-01-05 10:28
    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 2009-01-05 10:29
    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 2009-01-05 10:31
    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 2009-01-05 10:31
    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 2009-01-05 10:33
    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 2009-01-05 10:38
    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 2009-01-05 10:48
    Looks like a neat python WTF:
    http://www.pirnat.com/mike/2008/11/25/python-youre-doing-it-wrong/
  • greg 2009-01-05 10:50
    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 2009-01-05 10:51
    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 2009-01-05 10:53
    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 2009-01-05 10:55
    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() 2009-01-05 11:02
    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 2009-01-05 11:04
    NOT a WTF. This is a good thing. Anything that keeps HR from screwing things up is a good thing.
  • DaveK 2009-01-05 11:04
    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 2009-01-05 11:05
    (screwing things up for the employee)
  • Procedural 2009-01-05 11:06
    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 2009-01-05 11:10
    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 2009-01-05 11:10
    "about the baseline HR" => "above the baseline HR"
  • Procedural 2009-01-05 11:13
    Converting it to C-sharp is not a significant improvement.
  • I walked the dinosaur 2009-01-05 11:17
    What??? Over 9000?
  • convicted felon 2009-01-05 11:24
    By the end of that show, they're into the millions. Super Saiyans for the win.
  • Bobble 2009-01-05 11:27
    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 2009-01-05 11:29
    Thought it was C-pound?
  • AnonCoward23 2009-01-05 11:30
    Sprite_tm:
    Perhaps the guy is Dutch? Dutch 'teller' is English 'counter'.

    Or maybe he's German. German 'teller' is English 'plate'. :)
  • Wongo 2009-01-05 11:58
    In American, Teller = !Penn. Five of clubs anyone ?
  • lolwtf 2009-01-05 12:10
    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 2009-01-05 12:22
    I am far from a VB guru, but what in the name of binary is the teller=teller line about?
  • halcyon1234 2009-01-05 12:23
    Doing automated checks manually may take up 2 manweeks, but it saves a lot of cycles on the CPUmatron. Those things are VALUABLE!
  • Daniel 2009-01-05 12:24
    This hurt my eyes.

    God, you could pick any paragraph after the first, and it would still be a WTF.
  • Been there done that 2009-01-05 12:27
    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 2009-01-05 12:31
    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 2009-01-05 12:37
    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 2009-01-05 12:41
    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 2009-01-05 12:43
    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 2009-01-05 12:45
    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 2009-01-05 12:53
    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 2009-01-05 13:00
    MisterCheese:
    Thought it was C-pound?

    C£?

    That makes no sense.
  • weirded verber 2009-01-05 13:29
    yes... c-pound.
    I like C-Pound for the error handling
  • Code Dependent 2009-01-05 13:36
    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)
  • blabla 2009-01-05 13:37
    Tom:
    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.


    I don't think
    teller = teller + 1
    produces the same amount of instructions as
    teller = teller
  • Hans 2009-01-05 13:37
    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).


    Ah, you mean _FORTIS_. Well, I'm not surprised - they certainly managed to make a mess of my mortgage. Oh, and they "accidentally" (and without telling me!) stole about 20,000 euro of my money.

    The IT-fuckups I've seen come out of that particular outfit have been staggering over the years. Matched only by the malice of its management, really...

  • Smash King 2009-01-05 13:40
    hamBone:
    I am far from a VB guru, but what in the name of binary is the teller=teller line about?
    Optimization. His pseudo-code was supposed to be teller=teller+0, but he knew that addition wouldn't change the outcome and so he just assigned teller to teller.
  • Microfrost 2009-01-05 13:52
    Wongo:
    In American, Teller = !Penn. Five of clubs anyone ?


    You mean the three of clubs.
  • nobuddy 2009-01-05 14:26
    DaveK:
    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.


    If you want to write C, just write in C.
  • jspenguin 2009-01-05 14:30
    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.



    X='''import#cSNf=cS.S("=a32;19;=b46;=c43;=d126;16,19;=e58;=f120;fccee=g10;19,46;e=h96;ba=i45;11,61;=j33;j=k88;
    jd=l34;=m63;jhdjdjbaeieb19,55;=n60;14,114;jjj=o72;lebdaeecjddjjjdah=p37;k20,58;=q39;13,14;ddj=r77;jj=s62;jjkmj
    9;bbbjd20,60;13,130;jejrrjdekr7,54;ejbbdajbaahn20,179;eahaaaedabendjjrjkkorjjjkjkko=t116;rroookjaadad17,62;ddd
    dnqadjjjej4;krjjrjjjkorrr=u82;r=v83;kkk6,134;eaanh19,126;hnaane7,61;jkm6,64;krrrrkkrrrrm6,257;mjed17,190;eaqdd
    dnjjjkrrojjkrkrkookkk6,253;rrrrvk9,132;j14,193;eaaaaeehd7,42;kkktr10;o7,54;orrrrr6,13;e18,260;qdedj8,109;18;6,
    125;rmmrrrrjjkjj=w105;17,623;ndn7,317;11;=x56;rx7,8;6,71;8,517;kjmtmj17,68;deddjjjjm6,62;=y64;ryuruuu=z36;yyrr
    uru7,141;vk7,103;knmkj14,68;ekkan7,442;rxxrrxx=A66;uzrzzzzxyxu=B78;x6,138;rrrokk6,103;kjj13,69;bekjankrvrxryyz
    18;Axuz9,71;9,291;jk11,69;ejmjajm6,268;xzzzzx15,68;Auzzrrry14,70;j11,70;dnjjdan6,235;A19,136;5;rruzxruz14,71;1
    2,348;edddajekjk7,139;19;u6,142;ruxB13,73;njhig6,410;njedhdqejeorrxB24,144;zxrurrxuz8,431;rrurrrkjgaajkjhhddaa
    aedkrmvrrz23,216;7,286;zyuzr7,219;zrrrrkm=D76;gakdb8,764;hjjjrr=F35;zuu18,211;7,6;rzrruuu7,643;rr6,233;jmegaja
    dandaajjajjdhhaejjr11,74;urrjmjmmuumFux6,138;urzu7,722;zrrrjrjesgeaqasjdaqjjaajaaab10,365;yzzzuxxxorrjjkko=G87
    ;kzxzurzru=H53;6,582;uzzyrrrjjjnadgjaaqajaadjjaejekkok6,36;15,358;8,5;rr6,735;8,221;z6,75;jgadnjjjaajjja8,1024
    ;6,34;25,586;rzrzz6,941;uzz8,944;=I47;ehgaad10,77;11,994;13,152;uzu9,392;rrrrzur6,78;zzzrx8,1151;egaajdadaajjd
    akrrrp6,975;km9,157;Az6,1267;omruz6,294;zzyzxz7,561;Az8,78;gaadjaaaajjaqkrrmd7,1289;kj7,78;rurrrmjprrroj8,808;
    zzzrr8,916;ruy6,1638;gaans7,77;ajr=J102;afyFldjtmrdj8,529;rmk=K98;yjdhmmrvzryrrry6,1178;9,563;9,385;ajaaaaq6,9
    65;ejmraaajyjrnkrzzuHrzxrrrzjaikkkrrurA6,308;rryzuzA6,171;kmmjk12,77;aajjkjjjmeefojorerrzurxrzuorrrkbbb6,415;z
    urru8,899;9,1198;kjj6,906;6,1122;aajjmeeejjjrkrudj6,942;6,47;vjjrm6,1727;rzzrz8,761;7,228;rrrp6,154;6,2193;daa
    jddk7,1404;mdak6,947;7,46;11,1257;zx9,13;6,29;mjrrrpo14,1484;jjjjkv6,1857;ab11,703;AAx11,80;u10,143;9,1709;jmo
    jk12,1423;a6,838;6,412;7,289;8,703;x6,442;ry10,1563;8,42;k8,1716;kr7,77;daaan9,1829;ure11,780;x16,933;9,1355;m
    jrrjrxrkkjjItj8,77;qaaad9,921;rdjrrxyxrrrjrr17,1585;8,157;7,1889;zxrujrkjr8,77;aaaaq10,141;q7,657;rrkrk17,1013
    ;8,307;jj7,697;7,1517;22,77;j8,77;7,55;18,1080;6,881;j8,116;zzrzr13,77;a7,308;zrja6,1379;urrxzxrk14,1683;B7,77
    ;jjjmruuzzukrzzru16,77;mkrrzzrbn8,89;v=M85;vurkrz12,389;Fz7,77;kjt7,1470;orurrkzgaaaa=P44;iPaaaqjjjrrzurvrkebm
    jkrouuzurxx10,540;u7,385;jrrkrojr7,266;uBrrkjzgaaaiqh6,927;12,2370;xzurrxrAruurux8,1060;x7,1463;6,570;jruzrrjr
    7,2290;6,154;7,385;kk8,77;yurrzrryzzA9,1357;6,1404;y6,386;7,2555;zrurjkojjmmkr13,539;hjjjrmro8,1123;u6,57;uy9,
    1055;7,309;G7,77;jrzurrjjbrrjprmd17,924;6,234;Arrzzuurrru6,674;6,548;8,469;r6,217;jJFurdaaaahdjjj14,77;djjokjj
    djm6,46;m7,8;11,1058;12,616;r14,2478;qjjjrkjehddhdd6,3231;jkrjjjm6,2631;6,139;rr6,370;14,61;ajjdryrkbban6,1367
    ;jkorokjjhh7,2423;rrzzAz7,661;15,60;jmrurrjejkor9,968;jaakjvrrkzzrrzzzurkrrr15,2930;j6,203;s10,1868;krrjjej6,2
    134;Au6,555;r18,58;hmojrzusqrr6,295;jrr=Q54;jkjk7,1748;7,976;kzJ15,2909;hrkrzxka11,1019;6,299;11,56;ukyl17,296
    4;rmzrr6,872;k8,55;k6,405;xzkrzzurj18,3349;jkr9,54;k6,401;o8,459;uozzr15,3272;6,1139;mrrahm6,270;k6,1409;9,114
    8;zzF18,3451;hsrr=R107;adrro9,49;8,2626;rzr17,205;aaadhmrbajrmrkrjkzzy10,1978;19,96;aaahjraajjrrjkx7,137;zzrrF
    20,3593;aaaajpahdddk6,2467;rzzuu25,44;ajjfefo10,2369;=U42;25,42;ad6,720;uuury26,126;aaahdmmmrrrmrl27,38;aaaahh
    ddg").read;r=L:(Lc:c#and#ord(c))(f(1));m=Ln=0:(Lc:(L:m((c-48)+n*10),L:(n,c))[c#in("",59,44)]C)(rC);OcS.SC;w=o.
    write;v=o.getvalue;q={};t=i=0;Nwhile#1:TOrCTif#O=61:c=rC;n,OmC;q[c]=n;w(chr(n));t=nE48<=o<58:l,Om(o-48);b=-(L:
    [1],m)[O=44]C[0];[w(vC[b])for#z#in#xrange(l)]Enot#o:breakTelse:t=q[o];w(chr(t))Nprint#vC''';b=dict((x[0],x[1:]
    )for x in'Llambda |SStringIO|N\n|T\n |E\n elif |Oo=|C()|# | |\n'.split('|'));exec''.join(b.get(c,c)for c in X)


    This is deliberate, though...
  • eb0ny 2009-01-05 14:42
    http://www.python.org/doc/faq/programming/#is-it-possible-to-write-obfuscated-one-liners-in-python

    Even official Python FAQ says it is possible.
  • Matimus 2009-01-05 14:53
    I'm a huge fan of and advocate for Python. However, I have seen what happens when a huge organization (of engineers with just enough programming experience to be dangerous) is forced over to Python. The result makes me weep. There are volumes of bad code. Most of the code is just for short test scripts, but every once in a while someone gets the idea to completely rewrite a framework. The best you can say is that the WTFs don't tend to be front page worthy, though I haven't had the time to really dig.
  • Gentoo-Troll 2009-01-05 14:57
    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.


    Portage. http://www.gentoo.org

    Give me your paypal login/password and I'll just send the money to myself.
  • CodeReview 2009-01-05 15:02
    Code Dependent:
    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)


    god damn we see this all the time in code reviews...
    bool returnVal;
    if (expression == true) {
    returnVal = true;
    } else {
    returnVal = false;
    }
    return returnVal;

    can we all just agree that
    return (expression == true); does the same thing and stop fucking around?
  • ParkinT 2009-01-05 15:07
    MisterCheese:
    Thought it was C-pound?

    That is C-Orthocrop (C orthocrop run. Run orthocrop, run)
  • Jimmy Jay 2009-01-05 15:09
    Procedural:
    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.


    This pretty much says all that needs to be said. It is a what the fuck but so what? It did probably solve a large problem with minimal efforts.

    In all honesty if they hired a team of programmers to create the system it probably would have cost the company an absurd amount of money to get something with a bunch of worthless features they didn't need.


  • Brompot 2009-01-05 15:10
    The real WTF is that the story allows you to deduce which bank it is. Dutch words are used in the code, and there is only one Dutch bank with over 50.000 employees and over a hundred daughter companies (they are not really daughter companies BTW, they are 'member banks').

    This must be quite an old story. That bank has switched to SAP HR some years ago.
  • chrismcb 2009-01-05 15:42
    CodeReview:

    can we all just agree that
    return (expression == true); does the same thing and stop fucking around?


    Sorry, can't agree to that. Why not just say:

    return expression;

    Of course maybe you expect expression to return FileNotFound, in which case you really want to return false?
  • Waffle 2009-01-05 15:51
    Brompot:
    The real WTF is that the story allows you to deduce which bank it is. Dutch words are used in the code, and there is only one Dutch bank with over 50.000 employees and over a hundred daughter companies (they are not really daughter companies BTW, they are 'member banks').

    This must be quite an old story. That bank has switched to SAP HR some years ago.


    Read up: Belgian bank.

    And this is about HR *reporting* consolidated on the whole "holding". The systems that manage the actual payrolls are managed locally (and the big one in Belgium is indeed SAP). This story is less than 6 months old.

    As for the blame game... well, this is really an issue of communication and cooperation between HR and IT. HR dudes did what they could and hired one consultant (at a time ^ ^) for maintenance and managing the occasional crisis, thinking that they couldn't rely on IT since they had to do it themselves in the first place. IT was happy to not have to bother with it.

    And this is indeed a drop in the ocean in comparison of the what the upper management did to the clients and shareholders.
  • Teller 2009-01-05 16:13
    I'm thinking he was afraid of items (numbers) that would right Justify......


    <for the idiot(s): this is not serious......seriously, it isn't.....>
  • Voodoo Coder 2009-01-05 16:15
    Brompot:
    The real WTF is that the story allows you to deduce which bank it is. Dutch words are used in the code, and there is only one Dutch bank with over 50.000 employees and over a hundred daughter companies (they are not really daughter companies BTW, they are 'member banks').

    This must be quite an old story. That bank has switched to SAP HR some years ago.


    That language isn't exclusive to the Netherlands...

    And considering that the original poster has pointed out the country of origin....well, needless to say...
    Flemish!= Dutch

    (Although it's not as if it weren't easy to mix em up in this setting...)
  • Jim Bob 2009-01-05 16:16
    Procedural:
    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.


    Could not be put more eloquently!
  • Alexis de Torquemada 2009-01-05 16:22
    Procedural:
    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.


    Ok, even if we were to accept your wild assumptions up to this point…

    Procedural:
    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.


    If Rob's code worked that great, why are there dozens of versions of the spreadsheet each containing different ad hoc fixes? If Rob was such a wise man, why wouldn't he document his code before leaving the company? (Or why would the company let a genious (speling intentional) like him go?)

    Procedural:
    So a non-programmer doesn't know how to return a boolean in the most effective way ? So freaking what.


    You're right. Over 90% of the people don't know the first thing about programming. Nor do they need to. There's nothing to be ashamed of. However, of those 90%, most are wise enough to realize this fact and either refrain from writing computer programs or learn something first. It's unfortunate that Rob was not among this majority. You think it's arrogant of us to laugh about the WTF code written by clueless non-programmers? It's more arrogant to start writing code for professional purposes (and a multi-billion dollar company) without even getting a grip of the basics first (such as how to return values from a function or the lifetime of variables).

    Procedural:
    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).


    Every CS student would have written better code for a tenth of the money, though. And if Rob had really been worth his money, he would have given that student an internship.

    Procedural:
    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


    Again, it's not the fact that he didn't know about the latest and greatest in information technology. It's that he didn't know an assignment from his ass. This is elementary stuff. It's like building a house when you don't know the direction of gravity, or fixing an electrical device when you don't know the difference between AC and DC. I dare to claim that if a person were to display similar ineptitude in any other endeavor, you would call him an idiot yourself. (You aren't working in HR, are you?)

    By the way, reading Hans' comment was really entertaining after reading yours.
  • Telephony 2009-01-05 16:27
    ...."Enter your six digit pin, and then pound the hash key...." (or was that "hash the pound key" ???
  • Larry 2009-01-05 16:27
    ParkinT:
    MisterCheese:
    Thought it was C-pound?

    That is C-Orthocrop (C orthocrop run. Run orthocrop, run)


    That's "Octothorpe."

    Here's a little article about the term:
    http://www.worldwidewords.org/weirdwords/ww-oct1.htm
  • Voodoo Coder 2009-01-05 16:41
    Alexis de Torquemada:

    Procedural:
    So a non-programmer doesn't know how to return a boolean in the most effective way ? So freaking what.


    You're right. Over 90% of the people don't know the first thing about programming. Nor do they need to. There's nothing to be ashamed of. However, of those 90%, most are wise enough to realize this fact and either refrain from writing computer programs or learn something first. It's unfortunate that Rob was not among this majority. You think it's arrogant of us to laugh about the WTF code written by clueless non-programmers? It's more arrogant to start writing code for professional purposes (and a multi-billion dollar company) without even getting a grip of the basics first (such as how to return values from a function or the lifetime of variables).


    Very well put...

    I dunno about all other programmers, but I put a lot of time and money into my brain to get it where it is. I continue to spend time and money on professional development.

    As such, I get a little miffed when I see a non-pro messing around with code. They have about as much business looking at code as I do hanging out in an Operating room.

    Programmers who are passionate about their job get pissed when someone tries to play programmer...because they get to clean it up. Just like a doctor would probably be irritated cleaning up after me if I decided to play surgeon.

    Hobby programmers are allowed to screw things up, so long as they are doing it as a hobby. Once you write start writing production code in a professional environment...well, I'm an advocate for programmers to have a license to practice just as much as doctors are.
  • Cynic 2009-01-05 16:52
    Voodoo Coder:
    Alexis de Torquemada:

    Procedural:
    So a non-programmer doesn't know how to return a boolean in the most effective way ? So freaking what.


    You're right. Over 90% of the people don't know the first thing about programming. Nor do they need to. There's nothing to be ashamed of. However, of those 90%, most are wise enough to realize this fact and either refrain from writing computer programs or learn something first. It's unfortunate that Rob was not among this majority. You think it's arrogant of us to laugh about the WTF code written by clueless non-programmers? It's more arrogant to start writing code for professional purposes (and a multi-billion dollar company) without even getting a grip of the basics first (such as how to return values from a function or the lifetime of variables).


    Very well put...

    I dunno about all other programmers, but I put a lot of time and money into my brain to get it where it is. I continue to spend time and money on professional development.

    As such, I get a little miffed when I see a non-pro messing around with code. They have about as much business looking at code as I do hanging out in an Operating room.

    Programmers who are passionate about their job get pissed when someone tries to play programmer...because they get to clean it up. Just like a doctor would probably be irritated cleaning up after me if I decided to play surgeon.

    Hobby programmers are allowed to screw things up, so long as they are doing it as a hobby. Once you write start writing production code in a professional environment...well, I'm an advocate for programmers to have a license to practice just as much as doctors are.


    You mean making people accountable for their actions?

    Surely soceity is going in the opposite direction...Allowing people to blame someone else for all their f*&%-ups.....
  • Mr.'; Drop Database -- 2009-01-05 17:00
    Josh:
    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.
    How about the language's explicit self? It's easy to implement implicit self without surprises, but the authors of Python are so used to it that they no longer even see its ugliness.
  • Procedural 2009-01-05 17:04
    Voodoo Coder:
    Alexis de Torquemada:

    Procedural:
    So a non-programmer doesn't know how to return a boolean in the most effective way ? So freaking what.


    You're right. Over 90% of the people don't know the first thing about programming. Nor do they need to. There's nothing to be ashamed of. However, of those 90%, most are wise enough to realize this fact and either refrain from writing computer programs or learn something first. It's unfortunate that Rob was not among this majority. You think it's arrogant of us to laugh about the WTF code written by clueless non-programmers? It's more arrogant to start writing code for professional purposes (and a multi-billion dollar company) without even getting a grip of the basics first (such as how to return values from a function or the lifetime of variables).


    Very well put...

    I dunno about all other programmers, but I put a lot of time and money into my brain to get it where it is. I continue to spend time and money on professional development.

    As such, I get a little miffed when I see a non-pro messing around with code. They have about as much business looking at code as I do hanging out in an Operating room.

    Programmers who are passionate about their job get pissed when someone tries to play programmer...because they get to clean it up. Just like a doctor would probably be irritated cleaning up after me if I decided to play surgeon.

    Hobby programmers are allowed to screw things up, so long as they are doing it as a hobby. Once you write start writing production code in a professional environment...well, I'm an advocate for programmers to have a license to practice just as much as doctors are.


    If you'd spent even a minute in large European corporations you'd know that these hobby programmers are the rebellious few that force management into eventually building a full IT staff. Without them, a lot of things will still be done manually, and a lot of managers will not take the calls of your consulting outfit. Do they create great reliable code ? Very rarely (only the insane would defend that). Do they bring things forward for us all to eventually work on and improve a set of business processes ? Absolutely. They often create work that we would only have seen with a change in management (that tends to come late).

    Give them the credit they are due.
  • Coward 2009-01-05 17:15
    For those wondering, it was a Belgo-Dutch bankinsurer (notice the use of the past tense).


    Fortis eh? They just got split up ... they still exist. :P
  • Mike 2009-01-05 17:21
    Wyrd:
    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.

    The problem with, well basically *all*, spoken language is that the set of ways that you can answer questions incorrectly is far greater of the set of ways to do it right.

    (but seriously, what you just wrote was one of the most ignorant things I've ever read on this website)
  • Bottom Cod3r 2009-01-05 17:29
    Coward:
    For those wondering, it was a Belgo-Dutch bankinsurer (notice the use of the past tense).


    Fortis eh? They just got split up ... they still exist. :P


    But they're not a Belgo-Ducth bankinsurer anymore. IIRC, they're now
    - a dutch bankinsurer ;
    - a bank that is the daughter company of a french bank ;
    - and a belgo-dutch holding with pretty much nothing in it.
  • Havstein 2009-01-05 17:34
    Someone, post link to xkcd comic!
  • Anonym 2009-01-05 17:50
    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.


    I'd like to see a real assembler WTF.
  • Havstein 2009-01-05 17:51
    chrismcb:
    CodeReview:

    can we all just agree that
    return (expression == true); does the same thing and stop fucking around?


    Sorry, can't agree to that. Why not just say:

    return expression;

    Of course maybe you expect expression to return FileNotFound, in which case you really want to return false?

    You're wrong. Needs more evalution: return ((expression == true) == true);

    But if you really want an exception, you could keep chainin' those evaluations and hope for an OutOfMemoryException.
  • notromda 2009-01-05 17:54
    Josh:

    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.


    I don't remember what version, but early on, there was a push operation but no pop, or shift but no unshift, one of the two... I've never really gotten past that, even though they did eventually add it.
  • Cored 2009-01-05 17:55
    This is somewhat off-topic (and personal), but what do you guys think of employed students who write wtf-ery code? I worked at a small company when I was 16 for a few years, and I am quite ashamed of what I produced when I look back now. There wasn't any senior guidance and I didn't know any better.
  • chrismcb 2009-01-05 17:56
    Procedural:

    Give them the credit they are due.


    Well if we have to give them the credit they are due, we can surely laugh at the bad code they write.

    Especially when they put things like "teller = tellher" into an interpreted language.
  • Code Dependent 2009-01-05 18:01
    Cored:
    There wasn't any senior guidance and I didn't know any better.
    That's the point. Students don't (generally) have 10+ years of experience. It takes a while to build up your knowledge base.
  • Real-modo 2009-01-05 18:06
    DaveK:
    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!

    [serious]
    I feel for you. I was starting to learn Python when I realised that this essentially makes it a single-developer language.

    Python 3 could have fixed it by disallowing tabs.
    [/serious]
  • Mr.'; Drop Database -- 2009-01-05 18:31
    Real-modo:
    I feel for you. I was starting to learn Python when I realised that this essentially makes it a single-developer language.
    Assuming you're not using Notepad, you can use a menu option to convert tabs to spaces and vice versa. Note that the Python interpreter assumes tab stops every eight spaces. Some editors even have an option to show tabs as arrow symbols (very useful).
  • Gavin 2009-01-05 18:34
    That's because MS tried (and note that I did say try) to be intelligent. It is actuallly C-Sharp. The # symbol in music means that a note is raised by a semi-tone so transposed to computer languages, C# would rate "higher" than C.
  • Fedaykin 2009-01-05 18:43
    Wyrd:

    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?


    Python itself is a WTF. Invisible characters as a major component of your syntax? EPIC FAIL!
  • jspenguin 2009-01-05 18:57
    Fedaykin:
    Wyrd:

    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?


    Python itself is a WTF. Invisible characters as a major component of your syntax? EPIC FAIL!


    Perhaps Guido was just trying to avoid holy wars about which brace style to use.

    Try this: Open your Python interpreter and type:

    from __future__ import braces


    Then you don't have to worry about whitespace anymore.
  • Salami 2009-01-05 18:58
    Voodoo Coder:
    Alexis de Torquemada:

    Procedural:
    So a non-programmer doesn't know how to return a boolean in the most effective way ? So freaking what.


    You're right. Over 90% of the people don't know the first thing about programming. Nor do they need to. There's nothing to be ashamed of. However, of those 90%, most are wise enough to realize this fact and either refrain from writing computer programs or learn something first. It's unfortunate that Rob was not among this majority. You think it's arrogant of us to laugh about the WTF code written by clueless non-programmers? It's more arrogant to start writing code for professional purposes (and a multi-billion dollar company) without even getting a grip of the basics first (such as how to return values from a function or the lifetime of variables).


    Very well put...

    I dunno about all other programmers, but I put a lot of time and money into my brain to get it where it is. I continue to spend time and money on professional development.

    As such, I get a little miffed when I see a non-pro messing around with code. They have about as much business looking at code as I do hanging out in an Operating room.

    Programmers who are passionate about their job get pissed when someone tries to play programmer...because they get to clean it up. Just like a doctor would probably be irritated cleaning up after me if I decided to play surgeon.

    Hobby programmers are allowed to screw things up, so long as they are doing it as a hobby. Once you write start writing production code in a professional environment...well, I'm an advocate for programmers to have a license to practice just as much as doctors are.


    First of all, loading data is not mission critical, so comparing it to surgery is dumb.

    Secondly, there are loads of processes in the business world that require hours and hours of tedious, repetitive work. Usually, these processes involve Excel. In an ideal world, a "real" programmer would be brought in, but for various reasons this does not happen, usually because management is reluctant to spend the money to expedite a process that is already in place, even if the existing process involves repetetive, error-prone data entry by overworked clerks who have to give up their nights and weekends to get done. In this case, if some one can patch together some macros to help out, they will be seen as a savior, and the fact that a query takes 8 minutes is irrelevant and so is the quality of the code.
  • Meh 2009-01-05 19:37
    Salami:

    Voodoo Coder:

    Alexis de Torquemada:

    Procedural:
    <snip>

    <snip>

    <snip>


    First of all, loading data is not mission critical, so comparing it to surgery is dumb.

    Secondly, there are loads of processes in the business world that require hours and hours of tedious, repetitive work. Usually, these processes involve Excel. In an ideal world, a "real" programmer would be brought in, but for various reasons this does not happen, usually because management is reluctant to spend the money to expedite a process that is already in place, even if the existing process involves repetetive, error-prone data entry by overworked clerks who have to give up their nights and weekends to get done. In this case, if some one can patch together some macros to help out, they will be seen as a savior, and the fact that a query takes 8 minutes is irrelevant and so is the quality of the code.


    Loading data can be mission critical...

    Noone is arguing that management is reluctant to spend money, or that people do hack things together, the problem is that this SHOULD NOT happen.

    If you owned a transport company and you found one of your trucks was regularly breaking down, would you want your staff to attempt a fix, or would you hire a mechanic?
    Oddly enough many would allow a truckie to have a look at it (BAD MOVE), but few would allow their HR staff (even if they mess with cars as a hobby) to have a look....
    A truckie will probably fix it (short term).
    A hobbyist may fix it (possibly slightly longer term (ignoring for a second the likelihood that a hobbyist knows petrol engine cars, and the truck in all likelihood is diesel)).
    A mechanic will fix it (hopefully longest term - and if not is ACCOUNTABLE for his mistake).
    This, methinks, is the key. A professional doing what they're qualified to do is ACCOUNTABLE for what they do. A fiddler messing around with something is not. Sure, a lot of the time things may (seem to) work. Sure, management is happy 'cause they save money. Does this make it a good idea to do so? Probably not.
  • Joops 2009-01-05 19:42
    Meh:
    Salami:

    Voodoo Coder:

    Alexis de Torquemada:

    Procedural:
    <snip>

    <snip>

    <snip>


    First of all, loading data is not mission critical, so comparing it to surgery is dumb.

    Secondly, there are loads of processes in the business world that require hours and hours of tedious, repetitive work. Usually, these processes involve Excel. In an ideal world, a "real" programmer would be brought in, but for various reasons this does not happen, usually because management is reluctant to spend the money to expedite a process that is already in place, even if the existing process involves repetetive, error-prone data entry by overworked clerks who have to give up their nights and weekends to get done. In this case, if some one can patch together some macros to help out, they will be seen as a savior, and the fact that a query takes 8 minutes is irrelevant and so is the quality of the code.


    Loading data can be mission critical...

    Noone is arguing that management is reluctant to spend money, or that people do hack things together, the problem is that this SHOULD NOT happen.

    If you owned a transport company and you found one of your trucks was regularly breaking down, would you want your staff to attempt a fix, or would you hire a mechanic?
    Oddly enough many would allow a truckie to have a look at it (BAD MOVE), but few would allow their HR staff (even if they mess with cars as a hobby) to have a look....
    A truckie will probably fix it (short term).
    A hobbyist may fix it (possibly slightly longer term (ignoring for a second the likelihood that a hobbyist knows petrol engine cars, and the truck in all likelihood is diesel)).
    A mechanic will fix it (hopefully longest term - and if not is ACCOUNTABLE for his mistake).
    This, methinks, is the key. A professional doing what they're qualified to do is ACCOUNTABLE for what they do. A fiddler messing around with something is not. Sure, a lot of the time things may (seem to) work. Sure, management is happy 'cause they save money. Does this make it a good idea to do so? Probably not.


    Perhaps more to the point, in fixing it short term, the truckie may make it quite costly to fix long term in the future.
    The problem with a backyard-hacker putting together code such as this, is that it ends up costing more to fix than it would have. Sure, we could just start from scratch, but you'll find that if people are already used to using the hackers bits and pieces, they may be used to all sorts of little idio-syncracies (can't think of one in this particular example, I'll admit). The point is, that unless you can guarantee that you replicate IDENTICAL behaviour to what the backyarder has created, there is little point starting from scratch without more planning than would have been necessary had no system been implemented...

    Must say, I quite agree with the sentiment...If you're not a (qualified) Cook, get the F&%$ out of my Kitchen!!!
  • Procedural 2009-01-05 19:47
    Meh:
    Salami:

    Voodoo Coder:

    Alexis de Torquemada:

    Procedural:
    <snip>

    <snip>

    <snip>


    First of all, loading data is not mission critical, so comparing it to surgery is dumb.

    Secondly, there are loads of processes in the business world that require hours and hours of tedious, repetitive work. Usually, these processes involve Excel. In an ideal world, a "real" programmer would be brought in, but for various reasons this does not happen, usually because management is reluctant to spend the money to expedite a process that is already in place, even if the existing process involves repetetive, error-prone data entry by overworked clerks who have to give up their nights and weekends to get done. In this case, if some one can patch together some macros to help out, they will be seen as a savior, and the fact that a query takes 8 minutes is irrelevant and so is the quality of the code.


    Loading data can be mission critical...

    Noone is arguing that management is reluctant to spend money, or that people do hack things together, the problem is that this SHOULD NOT happen.

    If you owned a transport company and you found one of your trucks was regularly breaking down, would you want your staff to attempt a fix, or would you hire a mechanic?
    Oddly enough many would allow a truckie to have a look at it (BAD MOVE), but few would allow their HR staff (even if they mess with cars as a hobby) to have a look....
    A truckie will probably fix it (short term).
    A hobbyist may fix it (possibly slightly longer term (ignoring for a second the likelihood that a hobbyist knows petrol engine cars, and the truck in all likelihood is diesel)).
    A mechanic will fix it (hopefully longest term - and if not is ACCOUNTABLE for his mistake).
    This, methinks, is the key. A professional doing what they're qualified to do is ACCOUNTABLE for what they do. A fiddler messing around with something is not. Sure, a lot of the time things may (seem to) work. Sure, management is happy 'cause they save money. Does this make it a good idea to do so? Probably not.


    Not sure what you mean by that high accountability horse here... do you personally owe the company you work for money if your code has bugs in it ? Face the firing squad at dawn ? Or is your whole argument the fact that you can be reprimanded because you have a diploma ?

    Here's how it looks from management's point of view: the HR staff has highly cyclical waves of work thrown its way. When the company is growing they hire and interview; when it is shrinking they provide paperwork and follow-through; the rest of the year they help management with intervention, policy and guidance, help accounting with payroll and benefits, and help marketing by showing up in nifty suits at job fairs, universities and cocktails. IOW, there can be a lot of slack time. So I can get one guy to code up something useful but not really mission-critical (there are still a few eyes looking at a process that was already established but has changed) for no extra money ? If he fails I spend money that wouldn't have been spent on anything productive anyway (keeping the guy around). If he succeeds I can push off hiring an expensive IT guy for a quarter or two, and perhaps more. Sounds like a sweet deal to me. That may piss off a few certified developers, but we haven't built that firing squad wall yet anyway (HR thinks it might be illegal.)
  • hothead 2009-01-05 20:40
    Procedural:
    Meh:
    Salami:

    Voodoo Coder:

    Alexis de Torquemada:

    Procedural:
    <snip>

    <snip>

    <snip>


    First of all, loading data is not mission critical, so comparing it to surgery is dumb.

    Secondly, there are loads of processes in the business world that require hours and hours of tedious, repetitive work. Usually, these processes involve Excel. In an ideal world, a "real" programmer would be brought in, but for various reasons this does not happen, usually because management is reluctant to spend the money to expedite a process that is already in place, even if the existing process involves repetetive, error-prone data entry by overworked clerks who have to give up their nights and weekends to get done. In this case, if some one can patch together some macros to help out, they will be seen as a savior, and the fact that a query takes 8 minutes is irrelevant and so is the quality of the code.


    Loading data can be mission critical...

    Noone is arguing that management is reluctant to spend money, or that people do hack things together, the problem is that this SHOULD NOT happen.

    If you owned a transport company and you found one of your trucks was regularly breaking down, would you want your staff to attempt a fix, or would you hire a mechanic?
    Oddly enough many would allow a truckie to have a look at it (BAD MOVE), but few would allow their HR staff (even if they mess with cars as a hobby) to have a look....
    A truckie will probably fix it (short term).
    A hobbyist may fix it (possibly slightly longer term (ignoring for a second the likelihood that a hobbyist knows petrol engine cars, and the truck in all likelihood is diesel)).
    A mechanic will fix it (hopefully longest term - and if not is ACCOUNTABLE for his mistake).
    This, methinks, is the key. A professional doing what they're qualified to do is ACCOUNTABLE for what they do. A fiddler messing around with something is not. Sure, a lot of the time things may (seem to) work. Sure, management is happy 'cause they save money. Does this make it a good idea to do so? Probably not.


    Not sure what you mean by that high accountability horse here... do you personally owe the company you work for money if your code has bugs in it ? Face the firing squad at dawn ? Or is your whole argument the fact that you can be reprimanded because you have a diploma ?

    Here's how it looks from management's point of view: the HR staff has highly cyclical waves of work thrown its way. When the company is growing they hire and interview; when it is shrinking they provide paperwork and follow-through; the rest of the year they help management with intervention, policy and guidance, help accounting with payroll and benefits, and help marketing by showing up in nifty suits at job fairs, universities and cocktails. IOW, there can be a lot of slack time. So I can get one guy to code up something useful but not really mission-critical (there are still a few eyes looking at a process that was already established but has changed) for no extra money ? If he fails I spend money that wouldn't have been spent on anything productive anyway (keeping the guy around). If he succeeds I can push off hiring an expensive IT guy for a quarter or two, and perhaps more. Sounds like a sweet deal to me. That may piss off a few certified developers, but we haven't built that firing squad wall yet anyway (HR thinks it might be illegal.)


    Hmm...that's management material....I always thought managers have a unique (usually unrealistic) perspective of the world.

    The reality is that there are always tasks that HR people can do, and allowing one an undetermined amount of time to work on a little project that at best costs you his salary for however long it takes him (or her, of course) to figure it out seems a rather silly thing to do. I'm not a manager, so perhaps I see things from a totally different direction.
    You have to assume (especially given by the quality of code in the WTF), that there is little reason for management/supervisor to think that our friend Rob would be capable of such a task (other than he may one day have mentioned it in the coffee room).
    Though management wouldn't admit it, they would probably have little idea of how simple (or not) this task actually is (especially given that presumably the person authorising this is a fairly direct manager, who's required skills should be similar to those of his underlings (plus a few more, I guess)).
    Admittedly, it's probably higher management that deals with authorising monies to go places, but even so....
    1) Management is prepared to pay someone indefinitely to complete a task may have no idea of how to do
    2) Management is prepared to pay what it would have cost them in the first place in case poor Rob doesn't manage his task

    I suspect the more likely scenario, is that little Rob came up with this code at home (that is unpaid, and without authorization), and his coworkers simply adopted it. Aside from all else, this is more likely - this was written not as a piece of software with proper process to consider possible risks etc, but rather hacked together as a sparetime project.

    I doubt management would ever authorise such a task, and your justifications above have certainly failed to convince me.
    If you actually are a manager and think like that, then I'm a little bit disturbed. You have managed to give me quite an insight into why we actually need a million layers of management (so that the blame for such decisions can be nicely hidden somewhere in the middle layers).
    Companies go broke with that sort of attitude - 'We'll try to hack something together using anyone we find in the street that won't cost a penny, and only worry about consequences as they appear'.
    I often wonder how much more certain companies could make by
    1) having the guts to shell out the money when it needs to be shelled out, rather than trying to save a penny and losing out when it comes to fixing said problem)
    2) sacking the redundant management levels (some companies have become 90% management + 10% HR. The only reason senior management hasn't realised that there's no work going on below them, is because the message that poor Jim the last Techie died from exhaustion has gotten lost somewhere between the blokes who were 6 and 8 layers above him. Mind you, they are usually convinced (because that's what the person below them told them) that there whizz bang project will still get out by mid-march. I'm guessing with 10% HR, they stand a real good chance of that actually happening. Especially seeing as they just hired Rob - apparently he's done this before, so he might come in handy)
    3) actually investigating claims people make on their resumes (like even ringing one reference would be good). Surely this is why HR departments exist - to make sure the company gets the Human Resources they need...Rob just joined a multi-national as a senior programmer - his Resume' said that (despite not having formal qualification) he had single-handedly turned his former companies old manual methods into modern ones....
  • Bob 2009-01-05 21:19
    Procedural:
    The system works better than the older one but is still suboptimal and does not scale.

    Even assuming the most generous interpretation, I'ld love to see your employer apply the same logic to your pay, and when you bitch that sometimes you don't get paid, they'll defend that by pointing out that they fired the accountants and replaced them with some old guys who mean well and do math exercises as a hobby which is almost the same as knowing how to do accounting.

    Also, your counting skills would suit you for that role, because you missed the bit where the hero of this particular story was, in fact, not the first guy bought in, and apparantly there had been enough work to keep a whole bunch of people busy for quite a bit more than half an hour.



    Procedural:
    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).

    You honestly believe that he saved the employer so much money that having four consultants take turns fixing the code (at least one taking an entire year on the project) was still more cost effective than having hired someone competent to write it in the first place?

    What's that saying about being penny-wise and pound foolish? Fine, they saved cash for the first while by getting an idiot to write it, then a few years later they lost the salary of 4 consultants.

    And your claim doesn't work, either - even if he was being paid a "baseline" salary and doing it in spare time, when not busy with the duties he was hired for, that would just prove that a competent developer would not have taken a team of people an entire decade to write it. Penny wise, pound foolish. Again.


    Sorry, the most cheerfully optimistic interpretation here is that Rob was a competent amateur and management were morons for wasting money on all the incompetent consultants.

    Rob, I know you feel bad, but your self defense just doesn't seem quite right to me.


    But, if it helps, the fact that they had a large number of installed copies of the alleged "application" (I can't bring myself to call it an actual application) and bugs were fixed for individual users (when the users sent complained) but users who didn't notice got to keep their copy of the bugs is a hell of a bigger WTF than the fact that the code was crappy, anyway. For all Rob's faults, management wasn't too sharp either.
  • Procedural 2009-01-05 23:04
    hothead:
    Procedural:
    Meh:
    Salami:

    Voodoo Coder:

    Alexis de Torquemada:

    Procedural:
    <snip>

    <snip>

    <snip>


    First of all, loading data is not mission critical, so comparing it to surgery is dumb.

    Secondly, there are loads of processes in the business world that require hours and hours of tedious, repetitive work. Usually, these processes involve Excel. In an ideal world, a "real" programmer would be brought in, but for various reasons this does not happen, usually because management is reluctant to spend the money to expedite a process that is already in place, even if the existing process involves repetetive, error-prone data entry by overworked clerks who have to give up their nights and weekends to get done. In this case, if some one can patch together some macros to help out, they will be seen as a savior, and the fact that a query takes 8 minutes is irrelevant and so is the quality of the code.


    Loading data can be mission critical...

    Noone is arguing that management is reluctant to spend money, or that people do hack things together, the problem is that this SHOULD NOT happen.

    If you owned a transport company and you found one of your trucks was regularly breaking down, would you want your staff to attempt a fix, or would you hire a mechanic?
    Oddly enough many would allow a truckie to have a look at it (BAD MOVE), but few would allow their HR staff (even if they mess with cars as a hobby) to have a look....
    A truckie will probably fix it (short term).
    A hobbyist may fix it (possibly slightly longer term (ignoring for a second the likelihood that a hobbyist knows petrol engine cars, and the truck in all likelihood is diesel)).
    A mechanic will fix it (hopefully longest term - and if not is ACCOUNTABLE for his mistake).
    This, methinks, is the key. A professional doing what they're qualified to do is ACCOUNTABLE for what they do. A fiddler messing around with something is not. Sure, a lot of the time things may (seem to) work. Sure, management is happy 'cause they save money. Does this make it a good idea to do so? Probably not.


    Not sure what you mean by that high accountability horse here... do you personally owe the company you work for money if your code has bugs in it ? Face the firing squad at dawn ? Or is your whole argument the fact that you can be reprimanded because you have a diploma ?

    Here's how it looks from management's point of view: the HR staff has highly cyclical waves of work thrown its way. When the company is growing they hire and interview; when it is shrinking they provide paperwork and follow-through; the rest of the year they help management with intervention, policy and guidance, help accounting with payroll and benefits, and help marketing by showing up in nifty suits at job fairs, universities and cocktails. IOW, there can be a lot of slack time. So I can get one guy to code up something useful but not really mission-critical (there are still a few eyes looking at a process that was already established but has changed) for no extra money ? If he fails I spend money that wouldn't have been spent on anything productive anyway (keeping the guy around). If he succeeds I can push off hiring an expensive IT guy for a quarter or two, and perhaps more. Sounds like a sweet deal to me. That may piss off a few certified developers, but we haven't built that firing squad wall yet anyway (HR thinks it might be illegal.)


    Hmm...that's management material....I always thought managers have a unique (usually unrealistic) perspective of the world.

    The reality is that there are always tasks that HR people can do, and allowing one an undetermined amount of time to work on a little project that at best costs you his salary for however long it takes him (or her, of course) to figure it out seems a rather silly thing to do. I'm not a manager, so perhaps I see things from a totally different direction.
    You have to assume (especially given by the quality of code in the WTF), that there is little reason for management/supervisor to think that our friend Rob would be capable of such a task (other than he may one day have mentioned it in the coffee room).
    Though management wouldn't admit it, they would probably have little idea of how simple (or not) this task actually is (especially given that presumably the person authorising this is a fairly direct manager, who's required skills should be similar to those of his underlings (plus a few more, I guess)).
    Admittedly, it's probably higher management that deals with authorising monies to go places, but even so....
    1) Management is prepared to pay someone indefinitely to complete a task may have no idea of how to do
    2) Management is prepared to pay what it would have cost them in the first place in case poor Rob doesn't manage his task

    I suspect the more likely scenario, is that little Rob came up with this code at home (that is unpaid, and without authorization), and his coworkers simply adopted it. Aside from all else, this is more likely - this was written not as a piece of software with proper process to consider possible risks etc, but rather hacked together as a sparetime project.

    I doubt management would ever authorise such a task, and your justifications above have certainly failed to convince me.
    If you actually are a manager and think like that, then I'm a little bit disturbed. You have managed to give me quite an insight into why we actually need a million layers of management (so that the blame for such decisions can be nicely hidden somewhere in the middle layers).
    Companies go broke with that sort of attitude - 'We'll try to hack something together using anyone we find in the street that won't cost a penny, and only worry about consequences as they appear'.
    I often wonder how much more certain companies could make by
    1) having the guts to shell out the money when it needs to be shelled out, rather than trying to save a penny and losing out when it comes to fixing said problem)
    2) sacking the redundant management levels (some companies have become 90% management + 10% HR. The only reason senior management hasn't realised that there's no work going on below them, is because the message that poor Jim the last Techie died from exhaustion has gotten lost somewhere between the blokes who were 6 and 8 layers above him. Mind you, they are usually convinced (because that's what the person below them told them) that there whizz bang project will still get out by mid-march. I'm guessing with 10% HR, they stand a real good chance of that actually happening. Especially seeing as they just hired Rob - apparently he's done this before, so he might come in handy)
    3) actually investigating claims people make on their resumes (like even ringing one reference would be good). Surely this is why HR departments exist - to make sure the company gets the Human Resources they need...Rob just joined a multi-national as a senior programmer - his Resume' said that (despite not having formal qualification) he had single-handedly turned his former companies old manual methods into modern ones....


    Well, your world view presumes that:

    1. There is plenty of experienced available labour (usually false, a bit less now but not by much)

    2. The IT department is not one of those microcomputer high priesthoods that couldn't be bothered to write tools that people can actually use on their desktops, or makes people wait so long that even a clunky process now would be better than a perfect process 5 years from now. I've seen shops like that where the early engineers made such career-protecting moves that they ensconced the company in technologies that a minuscule few could handle; good for them, sucks for everybody else. Good luck finding experienced RPG labour these days.

    3. That the task described here is actually significant and mission-critical.

    The thing is, I understand that from the peaceful confines of a University or recliner chair that these theories make sense: there's always perfect labour available at just the right moment at a budgetary-sound cost to perform the required task up to rigorously defined standards. It would be great if it worked that way. Instead IT is overburdened, under-staffed, has a hard time recruiting competent seniors, and gets barely-coherent task descriptions dumped on them that need to be hammered out again and again into clear specs, taking more of the devs' time in the process and making the waiting list longer and longer. Other departments (production, marketing, finance, accounting, etc.) do react as they can: they cobble some code contraptions together that somewhat relieve the burden. Perfection be damned: pragmatism wins the day. And when an HR guy pulls a solution that (I will assume) IT couldn't perform in a useful amount of time (for whatever reason, including understaffing), I think he deserves praise, not scorn, even if he doesn't return his booleans in just the perfect and tidy way (how often would you have to run that code for that inefficiency to take as much time as has been spent on this discussion today ?) Nobody says it is a perfect job (far from it, obviously), but it beats having absolutely nothing to replace a manual clerical process (which I still believe this was meant to replace; what else could have predated it that actually was less efficient ?).
  • Zhiperis 2009-01-05 23:29
    Can I join the Essay contest too?????
  • Salami 2009-01-05 23:47
    Meh:
    Salami:

    Voodoo Coder:

    Alexis de Torquemada:

    Procedural:
    <snip>

    <snip>

    <snip>


    First of all, loading data is not mission critical, so comparing it to surgery is dumb.

    Secondly, there are loads of processes in the business world that require hours and hours of tedious, repetitive work. Usually, these processes involve Excel. In an ideal world, a "real" programmer would be brought in, but for various reasons this does not happen, usually because management is reluctant to spend the money to expedite a process that is already in place, even if the existing process involves repetetive, error-prone data entry by overworked clerks who have to give up their nights and weekends to get done. In this case, if some one can patch together some macros to help out, they will be seen as a savior, and the fact that a query takes 8 minutes is irrelevant and so is the quality of the code.


    Loading data can be mission critical...

    Noone is arguing that management is reluctant to spend money, or that people do hack things together, the problem is that this SHOULD NOT happen.

    If you owned a transport company and you found one of your trucks was regularly breaking down, would you want your staff to attempt a fix, or would you hire a mechanic?
    Oddly enough many would allow a truckie to have a look at it (BAD MOVE), but few would allow their HR staff (even if they mess with cars as a hobby) to have a look....
    A truckie will probably fix it (short term).
    A hobbyist may fix it (possibly slightly longer term (ignoring for a second the likelihood that a hobbyist knows petrol engine cars, and the truck in all likelihood is diesel)).
    A mechanic will fix it (hopefully longest term - and if not is ACCOUNTABLE for his mistake).
    This, methinks, is the key. A professional doing what they're qualified to do is ACCOUNTABLE for what they do. A fiddler messing around with something is not. Sure, a lot of the time things may (seem to) work. Sure, management is happy 'cause they save money. Does this make it a good idea to do so? Probably not.


    To me, the analogy is that there is no truck, but a bunch of people having to carry the freight on their back. An enterprising person comes along and cobbles together a cart, which makes things a lot easier. Then you come along, see the cart, and starts nitpicking that the cart squeaks when it moves and doesn't turn very well.
  • Doodle 2009-01-05 23:59
    Lots of Creative people here today!

    One comes up with the worlds greatest analogy, the other shoots down with world's greatest response...
    And all over something that don't matter for naught.

    love the four mile long posts too, people. Wish they actually said something, though.

    Blah!
  • Scarlet Manuka 2009-01-06 01:45
    Several people seem to be under the misconception that an inefficient method of returning a Boolean value is the main WTF with this piece of code. It isn't (though it is the hardest to understand why the coder thought it would be a good idea).

    The main WTF is that instead of using Excel's built-in function to count the number of non-blank cells in a given range, the code loops through each cell, does a text replacement on the contents to remove manual line breaks, and checks to see if the result is empty.

    A subsidiary WTF is that if a non-empty cell is found, the code continues to loop through all the remaining cells in the row, rather than ending the loop at that point.

    Using an extra, unnecessary Boolean to store the result before assigning it to the function (inefficiently) and clearing the local variables before the end of the function are minor WTFs - it is stupid code but it's not going to hurt the performance.


    Salami:
    To me, the analogy is that there is no truck, but a bunch of people having to carry the freight on their back. An enterprising person comes along and cobbles together a cart, which makes things a lot easier. Then you come along, see the cart, and starts nitpicking that the cart squeaks when it moves and doesn't turn very well.

    No, it's more like the Futurama episode "Mother's Day": "Wouldn't it work better if the wheels were round?"
  • Herby 2009-01-06 02:03
    lolwtf:
    It's C-Tic-Tac-Toe.

    ...


    Just remember that a chicken can be trained to play this game and win (usually against drunk bar patrons). I tend to think that not much has improved in Microsoft's version, still a "chicken language".
  • Niels 2009-01-06 03:21
    Python's plethora of 'slick' language features is what design patterns are for Java programmers - a great way to over engineer and over complicate.

    There's shitloads of crappy python code out there, and there will be more as soon as self-taught hobbyists everywhere are discovering the language.
  • bjolling 2009-01-06 03:44
    Doodle:
    Lots of Creative people here today!

    One comes up with the worlds greatest analogy, the other shoots down with world's greatest response...
    And all over something that don't matter for naught.

    love the four mile long posts too, people. Wish they actually said something, though.

    Blah!
    Lemme try.

    Last year I did about 3 weeks of consultancy for the same company as in the OP. From what I understood is that it takes a huge effort to convince IT to write an application for you. Because of the very rigid and procedural environment, they require a shit-load of documents, budgets approved, resources assigned and of course they need to get the right prioritization. If your problem isn't critical enough, it will never get placed on the road-map and you will never get past the first stage. So why bother writing up all documents for the pre-business case, business case, high level functional design, risk evaluation... ?

    Even if they would get a project, it would take a very long time to get it launched into production. Letting the local VB6 hobbyist write some small programs at least produces solutions with immediate impact on the problems that HR faced. Also HR will know that hiring consultants is way easier than trying to hire an internal developer, because that internal developer would just get placed in the IT department (not in HR) so this will get them nowhere.

    BTW, the code produced by their IT department is not really top notch. Because the name of the company is in the open now, it's probably not a good idea to go into details about this, but I might post it anonymized in the sidebar
  • Mike5 2009-01-06 03:51
    configurator:

    private bool Row_Is_Empty(long iRowNr, object lLastCol, Worksheet sh)
    {...}


    Autocoverted with a tool


    I like how this tool claims that the result is production-quality. Simply because it's C#? Come on...

    Mike5
  • NH 2009-01-06 04:16
    MisterCheese:
    Thought it was C-pound?


    C-hash of course - you have to smoke something to be able to use it! :-p
  • NH 2009-01-06 04:19
    CodeReview:
    Code Dependent:
    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)


    god damn we see this all the time in code reviews...
    bool returnVal;
    if (expression == true) {
    returnVal = true;
    } else {
    returnVal = false;
    }
    return returnVal;

    can we all just agree that
    return (expression == true); does the same thing and stop fucking around?


    Even optimize it as:

    return (expression);
  • NH 2009-01-06 04:30
    Anonym:
    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.


    I'd like to see a real assembler WTF.


    Be careful what you wish for.

    I suspect that you can get a lot of interesting examples from disassembling early computer virus code - especially the ones that obfuscated themselves.

    And I also suspect that there have been programmers that have made "invalid" jumps into the code to obtain the wanted result with the least amount of code. Not that unheard of in the early ages when the clock frequency was similar on all machines and a time delay was wanted. Worked fine until the hardware was upgraded.

    Even code that was designed with a specific version of the processor has been seen - like the classic Z80 CPU had a few "undocumented" operations, and if you installed a clone processor they weren't there. And some programmers did utilize these instructions to create more efficient code which caused problems in some cases.
  • Fred 2009-01-06 05:25
    Scarlet Manuka:

    Salami:
    To me, the analogy is that there is no truck, but a bunch of people having to carry the freight on their back. An enterprising person comes along and cobbles together a cart, which makes things a lot easier. Then you come along, see the cart, and starts nitpicking that the cart squeaks when it moves and doesn't turn very well.

    No, it's more like the Futurama episode "Mother's Day": "Wouldn't it work better if the wheels were round?"


    So I guess your point is, spending 3 days doing this is really no better than spending 3 weeks? Talk to me again after you've seen this process done by a secretary with a typewriter.
  • Fred 2009-01-06 05:25
    chrismcb:
    Procedural:

    Give them the credit they are due.


    Well if we have to give them the credit they are due, we can surely laugh at the bad code they write.

    Especially when they put things like "teller = tellher" into an interpreted language.


    It's not an interpreted language. VBS is interpreted. ASP Classic is interpreted. Excel VBA is compiled to a byte code machine, like Java or Python.

    Can we laugh now?
  • Fred 2009-01-06 05:25
    Alexis de Torquemada:

    Every CS student would have written better code for a tenth of the money, though. And if Rob had really been worth his money, he would have given that student an internship.


    You work where mid level managers can casually offer internships?
  • Fred 2009-01-06 05:26
    lolwtf:
    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.


    I call it a process that would of, or did, take 3 weeks out of a month to complete before it was automated.
  • Piercy 2009-01-06 05:41
    configurator:
    [code]
    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;
    *snip*

    Autocoverted with a tool


    this the one i use, find it nice and helpful :)
    http://www.developerfusion.com/tools/convert/vb-to-csharp/
  • Dutch 2009-01-06 05:43
    Dutch people don't make mistakes
  • Waffle 2009-01-06 06:51
    Dutch:
    Dutch people don't make mistakes


    Belgian ones do. Just look at the politicians.
  • Jesper 2009-01-06 07:30
    Note that the word "teller" is Dutch for "counter".
  • GalacticCowboy 2009-01-06 07:49
    Non-IT people accept solutions like this because it still justifies their existence. Who cares if a fully-automated solution could complete this in 5 minutes? At least they're needed 3 days out of the month! And they actually get some "down" time, unlike the old way of doing it where they worked 60-hour weeks for the whole month to get it done.

    For those who don't (or don't care to) read VB, the basic WTFs in the code are:

    1. Iterates over all cells in the row, even if we've already found the answer. If I have to check 10000 items to see if any meet a criteria, and the first one does, why check the remaining 9999?
    2. Uses an overly-convoluted mechanism to set an unnecessary temporary result variable.
    3. Resets a local variable (twice) for no reason whatsoever.
    4. Uses the same overly-convoluted mechanism to set the final result.
    5. Duplicates (badly) a built-in function.
  • IHasYerCheezburger 2009-01-06 08:03
    mbv:
    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).


    Dutch OR Belgium.
    KBC: 57000 employees (2007)
    Fortis: 56866 employees (2006, before the 2008 acquisition of ABN AMRO followed by the breakup and takeover by BNP Paribas)

    My guess is that it's KBC. I have some friends&family who work or worked there. I could ask someone to verify this story.
  • Anonymous 2009-01-06 08:23
    GalacticCowboy:
    Non-IT people accept solutions like this because it still justifies their existence. Who cares if a fully-automated solution could complete this in 5 minutes? At least they're needed 3 days out of the month! And they actually get some "down" time, unlike the old way of doing it where they worked 60-hour weeks for the whole month to get it done.

    For those who don't (or don't care to) read VB, the basic WTFs in the code are:

    1. Iterates over all cells in the row, even if we've already found the answer. If I have to check 10000 items to see if any meet a criteria, and the first one does, why check the remaining 9999?
    2. Uses an overly-convoluted mechanism to set an unnecessary temporary result variable.
    3. Resets a local variable (twice) for no reason whatsoever.
    4. Uses the same overly-convoluted mechanism to set the final result.
    5. Duplicates (badly) a built-in function.


    Golly, gee whiz... Thanks for the lesson. I'm glad someone finally came along to explain the WTFs in this code. Here I was all confused and thought that it was obfuscated source code. Turns out it's actually VB code and I didn't know how to read it.
  • Voodoo Coder 2009-01-06 08:39
    Salami:
    Meh:
    Salami:

    Voodoo Coder:

    Alexis de Torquemada:

    Procedural:
    <snip>

    <snip>

    <snip>


    <snip>
    To me, the analogy is that there is no truck, but a bunch of people having to carry the freight on their back. An enterprising person comes along and cobbles together a cart, which makes things a lot easier. Then you come along, see the cart, and starts nitpicking that the cart squeaks when it moves and doesn't turn very well.


    Wow, this one really fired everyone up...

    My original point is this: There is a lot of incompetence in our field (duh...). Enough that we don't need people from outside the field bringing more of it in.

    To those who said I understated the value of hobby programmers: No, I did not. You transposed "hobby programmer" with "junior programmer" in your head. Yeah, we need people to write the small jobs, and they are those who are working professionally, gaining experience. What we do not need is a power user who are learning to code by reading what the Macro Recorder in Excel spits out. I know a LOT of great programmers started out as hobbyists. But if you don't have a fundamental understanding of programming, you have no business writing production code.

    And to the comment about Excel providing a valid solution to some problems, sure. Right after I made the comment that I hadn't written VBA in years, I received a request to add a function to a spreadsheet template that would check an account number across a database. For that, it worked. Did I use Excel to input information into the database? Frick no, I'm a professional for chrissake. Small, rudimentary functions serve a purpose in an Excel spreadsheet (beyond what it is already capable of doing). If you are writing large solutions to real problems in Excel, you're in the wrong field, or your company has wildly unrealistic expectations of what Excel can do.

    Finally, which analogy works best? None of em. We're programmers. I said surgeon because it was the first thing that came to my head. Surgeons work in a REAL time crunch, and they often don't get second chances (we just hit "compile" and fix what's broke). A mechanic fixes an existing problem, not engineers a new one...although it is closer when you consider whether you want an experienced mechanic or a hack fixing your breaks.

    The cart loader is interesting. It brings up a valid point...some people are OK with "It works". Me, not so much. If this guy built a cart, it would be a box with one dowel rod axel, one made of taped together paper towel rolls, three wheels (one of which is a hardened jelly donut), and it would never make right turns. Could you load a truck with it? Sure.

    But when management comes down and asks for a simple upgrade, say, a bigger box on the cart...upgrading becomes fixing, which becomes replacing. With the RIGHT solution.

    Economics 101: How much did the RIGHT solution COST. Not the set cost, the Economics cost. Start adding things up...like, the cost of the first cart...the development of the monstrosity...the labor involved in keeping it operational, then trying to upgrade it, fixing it...then, realize that management, at this point, is invested in the pot. They will bring in a pro now, but they will tell the pro to fix the abomination that they have. After a minimum month of paying the pro, they MIGHT find out that there jelly donut cart was a waste of money to begin with, and start on a real solution.

    So please, don't tell me that employing hack programmers is better than none at all. For the record, I've been the hack programmer. I look back on the train wrecks I've created and shudder. And I also think "Man was I a jerk for thinking that I was a programmer..."

    Be proud of what you do, and get pissed when someone tries to trivialize it.
  • MrBester 2009-01-06 08:54
    NH:
    And I also suspect that there have been programmers that have made "invalid" jumps into the code to obtain the wanted result with the least amount of code. Not that unheard of in the early ages when the clock frequency was similar on all machines and a time delay was wanted. Worked fine until the hardware was upgraded.


    'Sright. A clbuttic example was "Centipede" on 8086 machines. Then Amstrad came along with their whizz-bang 8MHz CPU and you needed Jedi reflexes to play it on the easiest setting. So a little TSR COM was written and included on most coverdiscs to "slow" the box down by grabbing slices of CPU time...
  • Bellinghman 2009-01-06 09:16
    MrBester:
    'Sright. A clbuttic example was "Centipede" on 8086 machines. Then Amstrad came along with their whizz-bang 8MHz CPU and you needed Jedi reflexes to play it on the easiest setting. So a little TSR COM was written and included on most coverdiscs to "slow" the box down by grabbing slices of CPU time...
    Followed by the classic Turbo button on so many PCs of the following generation.

    (For those that never envcountered one, it didn't speed the machine up when pressed, it slowed the machine down when released. But you can't label a button 'slow down' when you can label it 'speed up' instead.)
  • anon 2009-01-06 09:26
    Not suprising at all. Some time ago i worked at one of the major retail sellers here. They would do HR tasks in Excel. For the other department, i had to program Excel spreadsheet, that would grab data from tables prepared weekly by SP on SQLserver, then they would edit data in excel, and submit it back. And that kinda tool for supply chain management. Some reporting was done via Excel too, until they reimplemented it via SSRS. As for this tool, row count was ~10.000. Other reports were generated from tables with ~600.000 rows(via excel pivots)
  • Yann 2009-01-06 11:32
    Mr.'; Drop Database --:
    How about the language's explicit self? It's easy to implement implicit self without surprises, but the authors of Python are so used to it that they no longer even see its ugliness.
    Yes, that is quite ugly. It relates to how dynamic the language is - which makes it fairly inobvious. Basically, any function you shove into a class becomes a method:
    class Foo: pass
    
    def function(self, str): print "String is:", str
    Foo.method=function
    This monstrosity turns a function into a method, which acts much the same except it requires the (unused) self argument to be a foo object. Any foo object also inherits it, but in them, the method is bound. It's quite possible, but strange and wasteful, to do aFoo.__class__.method(aFoo) instead of aFoo.method().

    Back to the point: Yes, Python allows plenty of WTFs. It's just sometimes more obvious when your code is NOT a WTF, and requires some experience to spout WTFs regularly.
  • DaveK 2009-01-06 13:52
    nobuddy:
    DaveK:
    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.


    If you want to write C, just write in C.
    That's how I would have done it if I had written it (scripted languages not my first choice for a cpu simulator!), but I was just stuck with maintaining it and had to figure out WTF was going wrong.
  • DaveK 2009-01-06 14:02
    Anonym:
    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.


    I'd like to see a real assembler WTF.
    Google "Story of Mel".
  • DaveK 2009-01-06 14:03
    jspenguin:
    Fedaykin:
    Wyrd:

    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?


    Python itself is a WTF. Invisible characters as a major component of your syntax? EPIC FAIL!


    Perhaps Guido was just trying to avoid holy wars about which brace style to use.

    Try this: Open your Python interpreter and type:

    from __future__ import braces


    Then you don't have to worry about whitespace anymore.
    <boggle> You can do that in Python? 'scuse me, I'm just off to try

    from __future__ import lottery_numbers
  • DaveK 2009-01-06 14:04
    Mike:
    Wyrd:
    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.

    The problem with, well basically *all*, spoken language is that the set of ways that you can answer questions incorrectly is far greater of the set of ways to do it right.

    (but seriously, what you just wrote was one of the most ignorant things I've ever read on this website)
    It does kind of assume that programmers write code by pressing keys randomly and hoping the resultant program just works, doesn't it?

    Hang on a minute though - isn't that how programmers *do* write code? Isn't that why we're all here in the first place?
  • Anon 2009-01-06 14:49
    Scarlet Manuka:
    The main WTF is that instead of using Excel's built-in function to count the number of non-blank cells in a given range, the code loops through each cell, does a text replacement on the contents to remove manual line breaks, and checks to see if the result is empty.

    A subsidiary WTF is that if a non-empty cell is found, the code continues to loop through all the remaining cells in the row, rather than ending the loop at that point.


    From a professional, yes, but it's clearly stated it was an amateur, who really ought to be forgiven such things.

    The real WTF is that the consultants who came in didn't recommend replacing the partially automated solution with a professionally developed, fully automated solution.
  • ogilmor 2009-01-06 16:03
    Thank you, thank you! for submitting this. Although not a programmer even I can see the WTF-ness of this, and I can also see past employers' IT practices wherein one department, usually HR and accounting, had their own "IT gurus" who usually weren't much good but had special "suck up talents" and were very protective of their territory. "Security" was the usual justification for such a setup, which makes no sense. Better to have another pair of eyes watching. It's actually worse security to have only one guy running the system - what if he goes bad?
  • Mr.'; Drop Database -- 2009-01-06 17:10
    Yann:
    Yes, that is quite ugly. It relates to how dynamic the language is - which makes it fairly inobvious. Basically, any function you shove into a class becomes a method:
    I know. It doesn't require an explicit self parameter any more than Javascript requires an explicit 'this' parameter. Javascript does have some semantic surprises with its implicit 'this' but they're entirely avoidable. The main issue is that the Python developers simply refuse to fix it.
  • stiggy 2009-01-06 20:35
    Havstein:
    chrismcb:
    CodeReview:

    can we all just agree that
    return (expression == true); does the same thing and stop fucking around?


    Sorry, can't agree to that. Why not just say:

    return expression;

    Of course maybe you expect expression to return FileNotFound, in which case you really want to return false?

    You're wrong. Needs more evalution: return ((expression == true) == true);

    But if you really want an exception, you could keep chainin' those evaluations and hope for an OutOfMemoryException.


    I prefer stack overflows

    bool IsTrue (bool expression)
    {
    return IsTrue(expression);
    }
  • Mr.'; Drop Database -- 2009-01-06 20:44
    stiggy:
    bool IsTrue (bool expression)
    {
    return IsTrue(expression);
    }
    bool IsTrue(bool b) { return !IsFalse(b); }
    bool IsFalse(bool b) { return !IsTrue(b); }
  • Anon 2009-01-07 02:44
    Do you seriously care about points as utterly insignificant as this during your code reviews? I'm not even sure it's worth the time it would take to point this out.

    My code reviews aim to report two types of items: broken and 'may break'. Broken means there's a bug, may break means under load/large data sets/other environments/future conditions, there may be a bug. We don't always fix the 'may break' ones.
  • Waffle 2009-01-07 04:01
    Anon:

    From a professional, yes, but it's clearly stated it was an amateur, who really ought to be forgiven such things.

    The real WTF is that the consultants who came in didn't recommend replacing the partially automated solution with a professionally developed, fully automated solution.


    What makes you think they didn't ?

    Unfortunately, the power leverage of a consultant in the HR department of a huge banking firm is somewhat... limited.
  • quintopia 2009-01-08 00:34
    I think the guy's problem is that he hasn't learned that if statements don't have to include an else statement.

    What he was good at was the more important part: giving people more work to do. More work means more jobs means more people getting paid. A true patriot if there ever was one.

    Even more importantly: He was able to convince these people to let him remain working for them even while increasing the amount of work they had to do. And getting money by applying a skill you don't have is a skill in and of itself.
  • Ryan 2009-01-08 06:04
    Fortis?
  • Ryan 2009-01-08 06:08
    I should add that I see this stuff all the time. That is systems based on Access and/or Excel.

    Access can be useful for these ends, but only when connected to SQL server. It's terribly unreliable and slow when the data's stored in Access. Otherwise it can provide solutions to problems in an extremely short timescale - which seems to be the cause of these sorta things.

    In both England and Netherlands.

    It's worse with Government-related things, though. Much worse.
  • Nile 2009-01-08 20:42
    As far as I can tell, the function is testing for an empty cell. Any empty cell, not just the special case of an entirely blank row.

    This is a surprisingly difficult task in Excel, as there's no concept of NULL and an 'empty' cell may contain a zero-length string or a numeric zero - and it's difficult to predict what an inspection function like IsBlank() or IsNumber() will do because the casting functions for imported csv files are unpredictable.

    You may well be reduced to checking every single cell if attempts to use Range.End(xlToRight) and Range.CurrentRegion have proven ineffective.

    Even so, the function is badly thought out and badly coded; and examination of the function itself should not distract us from considering it's fundamental flaw - namely, that it should not be needed at all, as there are better ways of importing csv data, both to Excel and to MS-Access.

    And, indeed, better system architectures, although that might be beyond an amateur programmer: 'big picture' thinking and analysis doesn't come easy to people who started out on code alone.



  • pink_fairy 2009-01-09 16:35
    blabla:
    Tom:
    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.


    I don't think
    teller = teller + 1
    produces the same amount of instructions as
    teller = teller
    Think one more time, O non-Z80 guru:

    teller = teller + 1 => INC A => 0x3C
    teller = teller => LD A,A => 0x7F

    An optimising Z80 compiler (is there any such thing?) might even convert the latter into a NOP (0x00).

    What do you mean, there's no reason to suppose that "teller" will be loaded into the accumulator? Obviously it's the most important variable in the whole dang function.

    And if you're going to complain about the difference in clock cycles ... well ... that wasn't part of the rubric. I dimly remember that INC A takes one, and I strongly suspect that LD A,A also takes one. If not, you're gonna have to rely on your trusty optimising assembler.

    Now, does anybody out there have the time to waste building a symmetric multiprocessor out of Z80 chips? I mean, the goddamn things probably cost less than a cent each these days...

    Oh, and for those looking for Python WTFs, try the entire os and sys packages for starters. Garnish with severe abuse of exceptions, decorated nicely with the dismal default output thereof, et voila!

    I truly love Python, but sometimes it gets on my tits. Idiots mixing space and tab characters do not, however. Python is capable of parsing itself, so there are a couple of neat little programs to sort this particular problem out which can be downloaded from the Web.

    I've got one, but I'm not going to share it until somebody builds me a Z80 SMP machine for $1 and a cup of Joe.
  • David 2009-01-12 22:22
    Fedaykin:
    Wyrd:

    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?


    Python itself is a WTF. Invisible characters as a major component of your syntax? EPIC FAIL!


    Check out whitespace then:

    http://en.wikipedia.org/wiki/Whitespace_(programming_language)
  • David 2009-01-12 22:34
    hothead:

    I suspect the more likely scenario, is that little Rob came up with this code at home (that is unpaid, and without authorization), and his coworkers simply adopted it.


    More likely it was done at work - Access usually ships with Office Pro, and the license is a bit pricey for home users. On the other hand Access and VB are on most corp desktops since they come with Office pro.

    The sad thing is that Excel and Access with VB are almost always the only development "solution" available on the average locked-down corporate desktop. It's just a case of using a hammer because it's the only tool in the box.
  • Hyuga 2009-01-14 16:44
    Read comp.lang.python. It usually has several of them every day, usually unintentionally.
  • huojia 2009-03-02 01:16
    &nbsp;&nbsp;
    货架racking.&nbsp;&nbsp; 仓储货架
    南京货架设备要产品包括:重型货架
    ,阁楼货架,超市Shelf,重量型货架,横梁式货架,驶入式货架... 仓储笼
    货架的形式与材料 · 立体仓库 · 货架厂
    物流规划设计的步骤与程序(货架的设计... 中国物流行业呈现三足鼎立抢市场 · 亚洲第三方物流的现状和发展 ... 托盘
    抽出式货架系列 · 重力式 货架/推入式货架钢托盘
    移动式货架 · 阁楼式货架 · 悬臂式货架
    系列 长件物料储存货架&nbsp;货架公司
  • hoodaticus 2009-03-21 21:26
    weirded verber:
    yes... c-pound.
    I like C-Pound for the error handling


    wtf?
  • tharpa 2010-02-23 13:56
    Procedural:
    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.


    Well said. A little too arrogant, maybe, but well-said nonetheless.