• (cs)

    I would believe this is C#.

  • Me (unregistered) in reply to Mike

    COUNT(*) could be better yet ....use COUNT(1) instead...

  • (cs) in reply to Me
    Me:
    COUNT(*) could be better yet ....use COUNT(1) instead...
    If your database optimizer can't figure out that those are the same thing, go download yourself a real database.

    (oooh - did someone just call Oracle a real database? Burn the heretic!)

  • (cs) in reply to JM
    JM:
    David:
    In a world where applications are full of overhead, doing things like retrieving data using SQL (interpreted on the server! just imagine the wasted cycles!) over TCP/IP (with all that extra bandwidth being wasted in headers!), etc. Jed just wanted to save cycles where he had control: his source code!

    And now imagine Don LaFontaine narrating that.

    ---snip---

    Even better, the "That Mitchel and Webb Look" version

    In a company headed for oblivion with a revolving door for the hapless and hopeless, who is left to uphold the truth and fix the cock-ups of the last tosser who got the sack?

    It's the SURPRISING ADVENTURES OF SIR SIMON CHICKEN-CAESAR!

    Addendum (2008-03-29 00:03): My apologies to Mr. Mitchell

  • zzp (unregistered) in reply to Mike
    Wow. When does it hit that there might be a better way?

    With Jed ? Never.

  • Jessta (unregistered) in reply to Mike

    It's interesting that the guy apparently didn't like arrays yet used an array to store the returned data from the sql query when he could have just stored the returned COUNT() as an int.

  • (cs)

    I'm sick of all you CS snobs with your "iterations" and your "arrays" ... everybody knows that structured programming is dead. Get over it.

    ;-)

  • Stacy Spear (unregistered) in reply to Mike

    When does it hit that if it ran in 3 seconds afterward, its a given that he didn't pull the whole table anymore.

  • (cs) in reply to Jed the third
    Jed the third:
    Ok, don't panic people when I say that I completely agree with Jed. Basic idea behind his solution is the generation of report in such a way that what-you-see-is-what-you-get. For every value you need to see in your summary report there is a corresponding c++ line that like this:
    out( "<td>" + getTotals("Company1",11,2003) + "</td>" );
    

    Next step is making it easy to read. We introduce new language extension - variable named like so iCompany1Nov2003, is not really a variable, but a function call to getTotals() that is executed like so: getTotals("Company1",11,2003). This language extension is of course only theoretical, becase it can be simulated with careful book keeping - every time compiler complains about "failed call" to a "function" like iCompany1Nov2003 we go into our Pending_Language_Extensions.h and manually add this "function" to the rest of them:

    iCompany1Nov2003 = getTotals(con, "Company1", 11, 2003);
    iCompany2Nov2003 = getTotals(con, "Company2", 11, 2003);
    iCompany3Nov2003 = getTotals(con, "Company3", 11, 2003);
    iCompany4Nov2003 = getTotals(con, "Company4", 11, 2003);
    ...
    

    This way we don't need to worry about actually implementing new language feature, and supporting it for all those complaining lamers :)

    No, no, NO!

    The C++ way would be to use templates. plus the wondrous ## abilities of the pre-processor.

    Obviously.

  • excelcode (unregistered) in reply to iMalc
    iMalc:
    Clearly someone had told him that conditional branches were slow and should be avoided at ABSOLUTELY ALL costs!

    pfft...that looks like excel code to me.

  • Jed the third (unregistered) in reply to real_aardvark

    No, no, NO!

    The C++ way would be to use templates. plus the wondrous ## abilities of the pre-processor.

    Obviously.

    Well, I agree that abbreviating things is not always the best solution. That's why I would just use function calls instead of macros and templates, and write:

    out( "" + getTotals("Company1",11,2003) + "" ); out( "" + getTotals("Company2",11,2003) + "" ); out( "" + getTotals("Company3",11,2003) + "" ); ...

    , and then listen to my coworkers complain about density and complexity of my code. I understand that this code is much harder to get into, but once you do it's much easier to maintain. All you have to realize is that because of the repetition this code is not as complex as it seems. To understand what's happening you only need to interpret the first line, and then diff it in your mind with other lines. Our brains are suprisingly good at diff:ing things, but nobody seems to use it. :)

  • (cs) in reply to Jed the third
    Jed the third:

    No, no, NO!

    The C++ way would be to use templates. plus the wondrous ## abilities of the pre-processor.

    Obviously.

    Well, I agree that abbreviating things is not always the best solution. That's why I would just use function calls instead of macros and templates, and write:

    out( "" + getTotals("Company1",11,2003) + "" ); out( "" + getTotals("Company2",11,2003) + "" ); out( "" + getTotals("Company3",11,2003) + "" ); ...

    , and then listen to my coworkers complain about density and complexity of my code. I understand that this code is much harder to get into, but once you do it's much easier to maintain. All you have to realize is that because of the repetition this code is not as complex as it seems. To understand what's happening you only need to interpret the first line, and then diff it in your mind with other lines. Our brains are suprisingly good at diff:ing things, but nobody seems to use it. :)

    OK, you win on the sarcasm war.

    Can we try that again with a list-comprehension?

  • sjc (unregistered)

    Is there no-one else out there who is a fan of Grandaddy and thought of Jed the robot from The Sophtware Slump?

  • (cs) in reply to Stacy Spear
    Stacy Spear:
    When does it hit that if it ran in 3 seconds afterward, its a given that he didn't pull the whole table anymore.
    I suppose you could say this was programmed using a 'wooden table'.

    //Comment about Irish Girl

  • Sancho (unregistered) in reply to Mike
    Mike:
    WTF?

    Why is nobody commenting on the fact that he retrieves all rows just to get row counts? getTotals is not adding to the data, it's overwritting the rows[] variable every time, just so he can get rows.length. As well, he's using "" so he retrieves all columns. Effectively downloading the entire table instead of using COUNT().

    Wow. When does it hit that there might be a better way?

    Well, clearly, this is not his biggest problem. His biggest problem is, that he is a total jerk ;-)
  • Thomas (unregistered)

    Where's the WTF? The guy wrote an honest bunch of code that works, without resorting to some fancy workarounds for lazy programmers...

    (That's the usual argument in my company when WTFs like this are exposed...)

  • dkf (unregistered) in reply to real_aardvark
    real_aardvark:
    The C++ way would be to use templates. plus the wondrous ## abilities of the pre-processor.
    You also need to use exceptions (how else are you supposed to get the value out?) and smart pointers. With all those wonderful features, it's important to use them all in every program!
  • AdT (unregistered) in reply to Thomas
    Thomas:
    Where's the WTF? The guy wrote an honest bunch of code that works, without resorting to some fancy workarounds for lazy programmers...

    (That's the usual argument in my company when WTFs like this are exposed...)

    I totally believe this, only the code does not work and the subset that works has horrible performance. I look forward to seeing some WTFs written by your non-lazy coworkers.

    Anonymous coward:
    At least he's using paramter binding.

    Good point. We have to give him credit for that. Admittedly, that's like giving Charles Manson credit for lawful parking, but, hey, it's better than nothing.

  • Jed the third (unregistered) in reply to real_aardvark
    OK, you win on the sarcasm war.

    Can we try that again with a list-comprehension?

    Yeaahhh... Thanks for the first price, but.. you know what... this may come as a shock to you, but... I wasn't really kidding. Not even a little... Heh, there's an unbeatable sarcasm strategy - be serious :)

  • Eric (unregistered)

    When your productivity is measured by how many lines of code you produce in a day, this is a good method for being more productive then your co-workers. If I got paid $1 per line of code, I'd never use loops or arrays! I'd hope to get assignments like: "sort this list of 100 elements!" and my answer would be "Manual Bubble sort!!" cha-ching!

  • blazar (unregistered)

    And for sure it's not the same Jed as John E. Davis, i.e. the author of the JED text editor (and slrn, etc.)

  • (Not The Real) Don LaFontaine (unregistered) in reply to Mike

    That impression is very ... impressive :)

Leave a comment on “Jed Code”

Log In or post as a guest

Replying to comment #:

« Return to Article