• (cs)

    <FONT style="BACKGROUND-COLOR: #efefef">i'm at...a loss of words to describe this....</FONT>

    this is such a genious piece of work. And to think, I've used loops all these years. How could I have possibly been so wrong!

  • (cs)

    Wow. It takes dedication to craft a WTF like that. Coincidentally, there was a posting on the CORBA newsgroup today which looks like was written by the same guy.

  • (cs)

    I'd hate to see the bill if the software needed to process 100 places. [6]

  • (unregistered)

    Wow this guy probably makes a bundle when they ask him for a 9th string. Maybe he's not so dumb. I can't imagine you could convince anyone else to maintain this code, so he's got job security too.

  • (cs)

    I'm just wondering what exactly it does. I guess comments weren't needed since its purpose is obvious...to someone anyways. I'm also wondering if they omitted the seventhplace check at the beginning on purpose or not.

  • (cs)

    Another example of a consultant getting paid by the number of lines of code.

    Good Christ that's a horrible piece of code....all those 'If' statements that have to be executed even if there is only one value passed.  And am I crazy (I don't know that much about PL/SQL ) but is he passing in a bunch of parameters delimited by the pipe character?

    [:|]

  • (cs) in reply to

    :
    Wow this guy probably makes a bundle when they ask him for a 9th string. Maybe he's not so dumb. I can't imagine you could convince anyone else to maintain this code, so he's got job security too.

    It'd be job insecurity if that guy was working for me. I'd give someone like that 2 choices:

    1 - Do it right
    2 - There's the door, have a nice day.

  • (cs) in reply to Kermos

    I dunno if this is true of PL/SQL (IANA Oracle Expert) but in some stored procedure langauges, the speed of having fixed variable names and no loops is orders of mangitude faster than having a loop that makes the variable names and then tests on them.  Why?

    Because the IF setup can be fully prepared and cached by the server as a single query.  The FOR Loop will require running a dynamic query for each variable (i.e., an EXECUTE in Postgres), meaning the database server can't prepare nearly as much of the query (as it can't assume anyhting about the SQL it will run without a really intelligent optimizer).

    I wouldn't be shocked that if PostgreSQL as another example behaved better with a stored proc like this than one that came up with the variable names dynamically.

    If anyone's really interested, I suppose I could test.

  • (cs)
    Alex Papadimoulis:

    It's from the "professional services" division of a company that shall remain nameless.

    Give us a hint.  Does this company advocate a "Redneck Lifestyle" and program in the nude?

  • (unregistered)

    If you could name names, we would be able to avoid hiring services from that firm...

  • (unregistered) in reply to
    :
    If you could name names, we would be able to avoid hiring services from that firm...


    my guess is one of the big four accounting firms
  • (unregistered)

    WOW...EYES HURT...CAN'T SEE...must go get shotgun and shoot pc, it has been contaminated beyond repair!!!

  • (unregistered)

    I don't see anything wrong with this code...

    Okay okay, I can't justify this one...[:$]

  • (unregistered)

    Don't companies have a thing called "code review"?

    Why wasn't this caught before it went to production?

    You do realize that if this went to review it would get laughed at...right?

    (Please tell me you realize that.)

  • (unregistered) in reply to

    <FONT style="BACKGROUND-COLOR: #efefef">At some places, all of the other developers are giant WTFs as well, so who's going to review the code?</FONT>

  • (unregistered) in reply to Bustaz Kool

    My "code review team" consists of a guy named Bob.

    When he's not sleeping, he's surfing the web for porn. So, you can imagine what sort of "review" he does.

  • (cs) in reply to LordHunter317

    LordHunter317:
    I dunno if this is true of PL/SQL (IANA Oracle Expert) but in some stored procedure langauges, the speed of having fixed variable names and no loops is orders of mangitude faster than having a loop that makes the variable names and then tests on them.  Why?

    Well, even if we accept the idea that loops are to be avoid, the first half is needlessly complicated by also avoiding nested IFs --- something he starts using in the second half.....

  • (unregistered)

    You've seen people who can't read if you make them hold their lips still, right?  And people who can't count up to eleven unless they're wearing open-toed sandals?  I suspect this is a guy who couldn't write a program if you disabled the Copy and Paste items in his Edit menu...

    Why is the US government wasting money shooting Iraqis?  It should be hunting these people down and electrocuting them in their cubicles.  You know it makes sense.

    : Bat :

  • (cs) in reply to JamesCurran
    JamesCurran:

    [image] LordHunter317 wrote:
    I dunno if this is true of PL/SQL (IANA Oracle Expert) but in some stored procedure langauges, the speed of having fixed variable names and no loops is orders of mangitude faster than having a loop that makes the variable names and then tests on them.  Why?

    Well, even if we accept the idea that loops are to be avoid, the first half is needlessly complicated by also avoiding nested IFs --- something he starts using in the second half.....

  • (cs) in reply to LordHunter317

    Can we please get a forum that works wtih FF?

    Anyway, the text of my post got b0rked:

    Yes, I'll agree the layout of the code is subotimal.   But some unfactored IF's don't really make a WTF.  Without knowing if a looping construct for this is really more efficent, I'm not sure this qualifies.

  • (unregistered) in reply to LordHunter317

    I'm using FireFox 1.0 in Windows and having no trouble with the forum software, though I agree it's needlessly overcomplicated.  It would be nice to have an IP-based "re-edit my comment" feature, but that's why every programmer is writing their own blog software...

  • (unregistered) in reply to LordHunter317

    I think it would be cool if every time you posted it stamped your ip address, computer name, social security info, and mother's maiden name.

  • (cs)

    Once more, repeat after me!

    Loops are slow... unroll those loops because loops are slow... unroll those loops because loops are slow... unroll those loops because loops are slow... unroll those loops because loops are slow... unroll those loops because loops are slow... unroll those loops because loops are slow... unroll those loops because loops are slow... unroll those loops because loops are slow... unroll those loops because loops are slow... unroll those loops because loops are slow... unroll those loops because loops are slow... unroll those loops because loops are slow........

  • (unregistered) in reply to LordHunter317

    Theres nothing to prepare - there is no actual data access happeing here. This code should really have been done in a higher level language

  • (unregistered)

    Loops maybe slow at times but is it better to save a few nanoseconds or have more readable easier to maintain code? I'd fall on the side of maintainability personally. And besides.. if you're entire app is being slowed down by loops maybe there are some bigger problems at work here. I've seen code that had many nested loops that was dog slow so yea they can be bad but I refactored it into one loop and bingo, it was tons faster and still within one loop. Most loops break down to a test and a jump.. by itself that should not be that slow (depends on what happens in the loop of course but just by itself loops aren't slow enough to give up the entire class of program flow structures). In this case someone mentioned that performing a loop might be magnitudes slower, so yea that might be bad but until I see benchmarks showing that its horrible enough to give up a simple loop for a small speed increase over this WTF I'll stick with a loop..

    And as an aside I hate doing loops in SQL, I do my best to keep processing out of the SP if possible.

  • (cs) in reply to

    I wish more people got accounts with names, and less people bitched about the forum software.

    It's harder to follow all those anoymous posts than to make a decent post with the software. If you can't make a decent post, perhaps you should post EXACTLY what you did, and what went wrong.

    You're all supposed to be developers right? You should know that a bug report saying: 'It doesn't work.' or 'I can't make a post.' is totally useless for the developer who wants to (and I'm certain Alex wants to make his forum cool) fix any bugs.

    Drak

  • (cs) in reply to Drak
    Drak:
    You're all supposed to be developers right? You should know that a bug report saying: 'It doesn't work.' or 'I can't make a post.' is totally useless for the developer who wants to (and I'm certain Alex wants to make his forum cool) fix any bugs.
    Developers are only developers for their own software. Anything else, they are users. [8-|]
  • (cs) in reply to Drak
    Drak:

    I wish more people got accounts with names, and less people bitched about the forum software.

    It's harder to follow all those anoymous posts than to make a decent post with the software. If you can't make a decent post, perhaps you should post EXACTLY what you did, and what went wrong.

    You're all supposed to be developers right? You should know that a bug report saying: 'It doesn't work.' or 'I can't make a post.' is totally useless for the developer who wants to (and I'm certain Alex wants to make his forum cool) fix any bugs.

    Drak

    I hit the quote button. I went to the end of the edit box, hit enter, and typed this text. I will then hit the post button.

    You can see the result.

  • (cs) in reply to Bellinghman

    Bellinghman:
    I hit the quote button. I went to the end of the edit box, hit enter, and typed this text. I will then hit the post button.

    You can see the result.

    The problem being, of course, that the software does not accept HTML (instead it wants BB). However, what it sends to the client browser does contain HTML markup codes. And when that's reflected back, it escapes the < and > characters and the user sees the tags.

    The WTF is - the software cannot accept its own output as input.

    The second WTF is that it does work with IE - but only by using a special control. This means that a majority of clients don't see the problem. But this is supposed to be a web site, not an IE site.

    I hope that Alex will get an update soon. At present, there are three things that irritate me about this site:

    1. Quoting under my (Opera) browser. Firing up IE is something I very rarely have to do otherwise.
    2. No threading. Compare with LiveJournal, where you can easily see which posts are replying to which (and therefore quoting is needed less).
    3. The large number of anonymous postings by people who don't even have the nous to put their names at the end of their posts (I can understand the not-registering bit). It's really quite difficult to carry out a debate on a topic if you can't tell which misguided ideas your opponent is espousing, and which are someone else's. 

    Point 3 is not the forum's fault, of course.

    On the positive side, I'd like to say:- Alex, thanks for this site. We may moan, but it's still quite usable, and the faults aren't yours. If people didn't care, you wouldn't get the wingeing. We do know it's not your paid job, but please keep it up.

  • (cs)

    That Corba posting on google is cool. I have replied. [:D]

  • (cs)

    For a guy who gets paid for every line of code, I think this is a real good solution... [;)]

  • (cs)

    Where can I get one of these jobs that pays me more money to write code like that?

  • (cs)

    Looks a whole lot like Andersen (err.. "Accenture" after the scandals?) code to me.

    The accounting dept of a company I worked for had those guys in to write some etl/like import code and they wound up with a --30-- page stored proc to do it.

  • (cs) in reply to Bellinghman
    Bellinghman:

    [image] Bellinghman wrote:
    I hit the quote button. I went to the end of the edit box, hit enter, and typed this text. I will then hit the post button.

    You can see the result.

    The problem being, of course, that the software does not accept HTML (instead it wants BB). However, what it sends to the client browser does contain HTML markup codes. And when that's reflected back, it escapes the < and > characters and the user sees the tags.

    This is what I'd call a good bug report. Esp. mentioning that you use a browser other than IE to browse the forum.

    Does it show escaped HTML when you hit the HTML button in the editor?

    Drak

  • (cs)

    I'm surprised nobody yet has mentioned that in the second half, two of the three "else" branches are identical aside from spacing, and I doubt this language is sensitive to spaces.

  • (cs) in reply to Raymond Chen

    Raymond Chen:
    I'm surprised nobody yet has mentioned that in the second half, two of the three "else" branches are identical aside from spacing, and I doubt this language is sensitive to spaces.

    Yes.. But, do you want to take a wild guess as to how many people read all the way to the bottom of the code? (I know I didn't [:$] )

  • (unregistered) in reply to Mike R

    I don't even look at the WTF code snippets. I just read the developer comments.

    That's where the true humor lies.

  • (cs) in reply to Jon Limjap

    Jon Limjap:
    Once more, repeat after me!

    Loops are slow... unroll those loops because loops are slow... unroll those loops because loops are slow... unroll those loops because loops are slow... unroll those loops because loops are slow... unroll those loops because loops are slow... unroll those loops because loops are slow... unroll those loops because loops are slow... unroll those loops because loops are slow... unroll those loops because loops are slow... unroll those loops because loops are slow... unroll those loops because loops are slow... unroll those loops because loops are slow........

    Your ideas intrigue me and I would like to subscribe to your newsletter.  Are you holding any "getting to know you" meetings in my area? [;)]

  • (unregistered) in reply to Jon Limjap

    Jon Limjap:
    Once more, repeat after me!

    Loops are slow... unroll those loops because loops are slow... unroll those loops because loops are slow... unroll those loops because loops are slow... unroll those loops because loops are slow... unroll those loops because loops are slow... unroll those loops because loops are slow... unroll those loops because loops are slow... unroll those loops because loops are slow... unroll those loops because loops are slow... unroll those loops because loops are slow... unroll those loops because loops are slow... unroll those loops because loops are slow........

    You know, after you read this a couple times, you get a subliminal message..."slow your roll...slow your roll..."

  • (cs) in reply to Drak
    Drak:

    I wish more people got accounts with names, and less people bitched about the forum software.

    I wish that the people who do the bitching (on any topic) would have the stones to sign their name to their viewpoint.

  • (unregistered) in reply to Bustaz Kool

    Bustaz Kool:
    I wish that the people who do the bitching (on any topic) would have the stones to sign their name to their viewpoint.

    Never!

  • (cs)

    Using an alternate browser is your problem. If 90% of people do it, then it is The Standard. Its like driving around with a caravan attached to your car. Then whinging that parking spaces dont cater for your vehicle. "But it meets street legal standards!".

    Sick of this ZOMG USE FIREFOX ITS THE NEW WAVE MAN crap. Until more than a few million people use it, I cant imagine anyone could be fucked going out of their way to make things work with it.

  • (unregistered) in reply to phx

    Heh, another IE zealot. Well, it is site of Microsoftie guy, what I can except? Website about WTF whom has itself WTF - how a sweet irony.

    And BTW writing www pages whom work with all popular browsers is not hard.

    "If 90% of people do it, then it is The Standard."
    Eat shit. Trilion flys cannot be wrong!

    "
    Sick of this ZOMG USE FIREFOX ITS THE NEW WAVE MAN crap."
    Sick of guys with attidude "were best and f*** the rest".

  • (cs) in reply to phx

    Call me crazy, but IMHO if a few million people are using it, even though that is a small percentage compared to IE, it seems worth considering supporting it.

    IE isn't the Standard.  HTML is the standard.  IE bastardizes that by using non-standard HTML and JavaScript constructs, as well as utilizing a plethora of whiz-bang Active-X plug-ins to try to make sure they stay "the standard", meanwhile opening up gazillions of security holes due to it.

    I love looking at Page Properties in Firefox when viewing sites - the IE-centric ones all require Firefox to use a rendering mode called "Quirks", which by my understanding means it has to attempt to interpret the page like IE would, since it doesn't follow standards.  I could easily be wrong here, and feel free to educate me.


  • (cs) in reply to Blue

    Furthermore, a big reason for 90% usage is that it comes with the OS, most end users are too lazy / incompetent to get a better (or at least different, depending on your viewpoint) browser, which causes people to end up designing sites that work best in it (IE), which in turn causes the vicious cycle that has brought us to where we are today.

    I also agree strongly with the earlier post that it isn't that hard to write multiple-browser compatible pages.




  • (unregistered) in reply to Blue

    Actually, Quirks mode is entered when the doc type of the page is not declared correctly.  Since almost no design applications actually declare the doc type correctly, Firefox renders most sites in Quirks mode.

    Not really IE's fault, but it is symptomatic of lax coding techniques that I've noticed many IE-only developers fall into...bit of a flame, I know, but 'tis true.

  • (cs) in reply to

    Thanks for the clarification - as I said I'm not yet familiar with the ins-and-outs of FireFox, but for my personal use, I strongly prefer it.  Even with the quirks that it admittedly has.

    In particular, I really like AdBlock and the Web Developer toolbar extensions, Mouse Gesture extensions, ability to easily theme/skin the interface, and several features that I don't find as easily accessible (or in some cases present at all!) for IE.     !

    I can't even do tabbed browsing in IE unless I install CrazyBrowser or Avant or something similar. (IE lovers, feel free to correct me if I'm wrong.)


  • (cs) in reply to Blue

    You're right about the tabbed interface -- and it was discussed in the IE community (the folks who develop IE, not those who develop for it). I wish I still had the link to that discussion. That suggestion caused quite the furor, since it breaks with the "document" interface standard that MS has been trying to push. (Note that every Word doc or Excel sheet opens in its own window, with its own taskbar entry if you haven't selected the "stack" option.) There are some very bright people out there who firmly believe that users don't want an application open, they want a document. I don't happen to agree, but I'm not on the UI standards team at MS. Until the SDI interface standard goes away, neither IE nor its heirs and assigns are ever likely to come with tabs "out of the box".

  • (cs) in reply to Stan Rogers

    Thanks for your comment.

    I note that they don't strictly conform to that in Excel - note the Workbook concept, with tabbed worksheets.   So they do understand on some level that we mere humans are capable of using MDI apps.

    At the very least, make it optional and disabled by default!!




  • (unregistered)

    this is just plain good ol' loop unrolling

Leave a comment on “Real Consultants Don't Use Loops”

Log In or post as a guest

Replying to comment #:

« Return to Article