Comment On Jed Code

"About two years ago," Simon writes, "I worked for a small telecommunications company. Turnover was fairly high, leaving not much consistency in the way applications were developed." [expand full text]
« PrevPage 1 | Page 2Next »

Re: Jed Code

2008-03-28 08:10 • by Kluge Doctor (unregistered)
Comment for Current Article
//Comment for Tomorrow's Article
//Comment for Day After Tomorrow's Article
//Comment for Two Days After Tommorow's Article
//Comment for Three Days After Tomorrow's Article

Re: Jed Code

2008-03-28 08:11 • by Anonymous coward (unregistered)
At least he's using paramter binding.

Re: Jed Code

2008-03-28 08:15 • by Martin (unregistered)
I totaly agree. Loops and arrays are bad. Any good programs uses goto statements and hard coded variables like that! Anyone have to agree to that:P

Re: Jed Code

2008-03-28 08:17 • by ParkinT
186530 in reply to 186527
Kluge Doctor:
Comment for Current Article
//Comment for Tomorrow's Article
//Comment for Day After Tomorrow's Article
//Comment for Two Days After Tommorow's Article
//Comment for Three Days After Tomorrow's Article


I vote this one as a FEATURED comment.
{Alex, are you there? }

Re: Jed Code

2008-03-28 08:22 • by Erick
Ugh. As a user of SQL Server Reporting Services, this is extremely painful to look at. I've made some convoluted reports, but nothing this moronic.

Re: Jed Code

2008-03-28 08:43 • by NO no NO! (unregistered)
This is great. From now on no Loops or Arrays you morons! They are out dated and produce to little KLOC.

Btw. this Jed defeinitely learned from the other Jed. It would be hilarious to watch those guys discuss their programming techniques. Like a Titanic movie for geeks!

Highlighted comments

2008-03-28 08:50 • by AlpineR
Alex,

I enjoy the newish highlighted comments feature. Sometimes I don't have time to wade through 100+ comments, and it's nice to have quick access to a few of the best.

But it seems that you or whoever does the highlighting stops after the first couple hours of posting. I often look back the next day to check on comments added overnight and none of them are ever highlighted.

Could you please do something so that the best late-posted comments get attention too?

AlpineR

Re: Jed Code

2008-03-28 08:57 • by atkretsch (unregistered)
My heart was racing there for a second until he said "just kidding." Simon, you prankster!

Re: Jed Code

2008-03-28 09:17 • by bushel (unregistered)
186541 in reply to 186527
Response to current comment.
//Response to retort
//Counter-argument to reply to response
//Interim summary of discussion
//Reply to tangential response

Re: Jed Code

2008-03-28 09:18 • by taylonr
186542 in reply to 186529
TRWTF is that Simon didn't use SSDS to find all the places that he would need to uncomment, then he could have owned his data

Re: Jed Code

2008-03-28 09:34 • by Rank Amateur
186551 in reply to 186535
NO no NO!:
This is great. From now on no Loops or Arrays you morons! They are out dated and produce too little KLOC.


Quite right. Get with modern coding practices. There's nothing an array and loop can do that you can't do with XML and exceptions, and a little imagination.

--Rank

Re: Jed Code

2008-03-28 09:50 • by FredSaw
Rather than write a software loop, put yourself in a realtime loop. Very efficient.

Re: Jed Code

2008-03-28 09:52 • by jamie (unregistered)
186555 in reply to 186541
bushel:
Response to current comment.
//Response to retort
//Counter-argument to reply to response
//Interim summary of discussion
//Reply to tangential response


followed by.....

This is not a WTF
//yes it is
//it is a little
//this is not a WTF
//repeat and rinse

Re: Jed Code

2008-03-28 10:01 • by Joaquin (unregistered)
I don't see the problem. You guys are always saying that using where is faster! :)

And yes, the :) means I'm not serious.

Re: Jed Code

2008-03-28 10:15 • by David (unregistered)
I can understand Jed.

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!

// just kidding! why is he unrolling the loop? that used to work great when we had like 64kB of memory cache, but today??? FFS...

Re: Jed Code

2008-03-28 10:26 • by JM (unregistered)
186566 in reply to 186561
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.

In a world... Sped-up footage of New York traffic

where applications are full of overhead... server room with tape drives spinning

Jed just wanted to save cycles where he had control... Jed behind his computer

His SOURCE CODE. Camera rotates to screen, zoom in and fade

This summer... flash 'W'

Programming is about to get... flash 'T'

SERIOUS. flash 'F'

Re: Jed Code

2008-03-28 10:42 • by WhiskeyJack
Ha! I'd watch that movie.

I can't see anything in the original code about months being commented out, was that just left out of the shown code snippet?

Re: Jed Code

2008-03-28 10:45 • by DeLos
The real WTF is using a DB instead of flat files.

Flat files take up less room.

Re: Jed Code

2008-03-28 10:50 • by burntfuse
186579 in reply to 186566
JM:
And now imagine Don LaFontaine narrating that.

In a world... Sped-up footage of New York traffic

where applications are full of overhead... server room with tape drives spinning

Jed just wanted to save cycles where he had control... Jed behind his computer

His SOURCE CODE. Camera rotates to screen, zoom in and fade

This summer... flash 'W'

Programming is about to get... flash 'T'

SERIOUS. flash 'F'


That's just...wow...you win for best post ever.

Re: Jed Code

2008-03-28 11:14 • by Enterprise Code (unregistered)
186582 in reply to 186528
Anonymous coward:
At least he's using paramter binding.
Alas, the getTotals() function was a total disappointment. Shouldn't that have been

if(companyCode.equals("Company1") && month == 1 && year == 2003)

rows[] = dbConn.exec("select * from COMPANY_TRANS "
"where companyCode = 'Company1' "
"and month = 1 and year = 2003");
if(companyCode.equals("Company1") && month == 2 && year == 2003)
rows[] = dbConn.exec("select * from COMPANY_TRANS "
"where companyCode = 'Company1' "
"and month = 2 and year = 2003");
if(companyCode.equals("Company1") && month == 3 && year == 2003)
rows[] = dbConn.exec("select * from COMPANY_TRANS "
"where companyCode = 'Company1' "
"and month = 3 and year = 2003");

Re: Jed Code

2008-03-28 11:17 • by taylonr
186584 in reply to 186566
JM:
And now imagine Don LaFontaine narrating that.

In a world... Sped-up footage of New York traffic

where applications are full of overhead... server room with tape drives spinning

Jed just wanted to save cycles where he had control... Jed behind his computer

His SOURCE CODE. Camera rotates to screen, zoom in and fade

This summer... flash 'W'

Programming is about to get... flash 'T'

SERIOUS. flash 'F'


Thread over, go home.

Re: Jed Code

2008-03-28 11:31 • by Southern (unregistered)
No loop for you!

Re: Jed Code

2008-03-28 11:38 • by SomeCoder (unregistered)
186592 in reply to 186584
taylonr:
JM:
And now imagine Don LaFontaine narrating that.

In a world... Sped-up footage of New York traffic

where applications are full of overhead... server room with tape drives spinning

Jed just wanted to save cycles where he had control... Jed behind his computer

His SOURCE CODE. Camera rotates to screen, zoom in and fade

This summer... flash 'W'

Programming is about to get... flash 'T'

SERIOUS. flash 'F'


Thread over, go home.



It's true, I don't think we can do any better than this. The bar is just too high now :)

Re: Jed Code

2008-03-28 11:44 • by Outlaw Programmer
186595 in reply to 186592
JM is now REQUIRED to create a mock-trailer for this film. I suggest editing footage from Hackers.

Re: Jed Code

2008-03-28 12:04 • by Zylon
My first programming class in high school, the instructor forced us to write a little program to track four salesmen without using arrays.

No, he wasn't a "Jed". The point was to pound into everyone (most of these people had no prior prgramming experience) how useful arrays are. I'd say it was a success.

Re: Jed Code

2008-03-28 12:19 • by Mike (unregistered)
186601 in reply to 186529
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?

Re: Jed Code

2008-03-28 12:34 • by stationary
Now, listen to a story 'bout a man named Jed
A poor programmer, whose code was seldom read
Seems one day he was avoidin' some loops
Leaving our Simon to say, "What the boop?"

Eff, that is. Bad code, hurts to see.

Next thing you, Jed don't need to care
Boss-man say, "Get away from there!
Off the computer, is where you ought to be!"
And Simon sent the tale to the Daily.

WTF, that is. Coding n00bs, error shots.

HR WTF

2008-03-28 12:44 • by Raedwald
I know we've said it before, but.

How do these people get jobs?
How do they hold them?

Re: HR WTF

2008-03-28 12:55 • by brazzy
186615 in reply to 186611
Raedwald:
I know we've said it before, but.

How do these people get jobs?
How do they hold them?

By finding and staying with companies whose managers care exclusively about deadlines being met and features implemented no matter what, and that employees work exclusively towards these goals rather than creating problems for the managers by asking questions or pointing out bad practices.

Re: Jed Code

2008-03-28 13:12 • by Mikael Bergkvist (unregistered)
How the hell does people like that get hired?
Is the employer really THAT desperate?

Re: Jed Code

2008-03-28 13:12 • by Mikael Bergkvist (unregistered)
Oh.. maybe by reading the preceding post..

Re: Jed Code

2008-03-28 13:32 • by Anonymous (unregistered)
out( "<td>" + (iCompany1Nov2003 + iCompany2Nov2003 + ... + iCompany7Nov2003 "</td>" );


hmm, wouldn't this caused compilation error?

Re: Jed Code

2008-03-28 13:36 • by elias
186624 in reply to 186607
stationary:
Now, listen to a story 'bout a man named Jed
A poor programmer, whose code was seldom read
Seems one day he was avoidin' some loops
Leaving our Simon to say, "What the boop?"

Eff, that is. Bad code, hurts to see.

Next thing you, Jed don't need to care
Boss-man say, "Get away from there!
Off the computer, is where you ought to be!"
And Simon sent the tale to the Daily.

WTF, that is. Coding n00bs, error shots.

LOL

Re: Jed Code

2008-03-28 13:38 • by Dean (unregistered)
Now _that's_ productivity! Just look at all that code!

Re: Jed Code

2008-03-28 13:38 • by Andrew (unregistered)
186626 in reply to 186561
David:
I can understand Jed.

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!

// just kidding! why is he unrolling the loop? that used to work great when we had like 64kB of memory cache, but today??? FFS...


Actually, unrolling such a loop was more expensive when there was only 64kB of memory cache. Only a few iterations, or certain nesting should get unrolled, even today. Processor speed, at 5Mhz or less, was what slowed down loops.

I think programmers today try to be too clever. They should write code to the strengths of the system, e.g. SQL fetches sets in a loop, not to some peculiar (or false) optimization.

Re: Jed Code

2008-03-28 13:50 • by Jesse (unregistered)
any relation to Jed Clampett?

Re: Jed Code

2008-03-28 13:51 • by k (unregistered)
I thought the title of the article was "Jedi Code", and was expecting some sort of "These aren't the variables you're looking for" reference.

Re: Jed Code

2008-03-28 13:54 • by cdzerg (unregistered)
186630 in reply to 186527
iCdzerg01 .....
iCdzerg02 .....
iCdzerg03 .....
iCdzerg04 .....
iCdzerg05 .....
iCdzerg06 .....
iCdzerg07 .....
iCdzerg08 .....
iCdzerg09 .....
iCdzerg10 .....
iCdzerg11 .....
iCdzerg12 .....
iCdzerg13 .....
iCdzerg14 .....
iCdzerg15 .....
iCdzerg16 .....
iCdzerg17 .....
iCdzerg18 .....
iCdzerg19 .....
iCdzerg20 .....

Re: Jed Code

2008-03-28 14:14 • by <Maybe Anon?> (unregistered)
186632 in reply to 186629
k:
I thought the title of the article was "Jedi Code", and was expecting some sort of "These aren't the variables you're looking for" reference.

Re: Jed Code

2008-03-28 14:23 • by JUST ANOTHER WTF (unregistered)
I don't see the problem... he just unrolled the loops for optimization

Re: Jed Code

2008-03-28 14:33 • by Chuck (unregistered)
I know at least one possible motivation for writing code like this. I knew a guy who would love to write this kind of tedious crap just so he wouldn't have to think very hard and it would keep him occupied for days. And yes he had a four-year BS in Computer Science, unbelievable.

Re: Jed Code

2008-03-28 14:38 • by Bobby (unregistered)
186638 in reply to 186601
Mike:

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

Apparently when the page takes 8 minutes to load!

Re: Jedi Code

2008-03-28 14:54 • by real_aardvark
186639 in reply to 186632
<Maybe Anon?>:
k:
I thought the title of the article was "Jedi Code", and was expecting some sort of "These aren't the variables you're looking for" reference.

Okey dokey.

Stormtrooper: Let me download teh codez.
Obi-Wan -- with a small wave of his hand: You don't need to download teh codez.
Stormtrooper: We don't need to download teh codez.
Obi-Wan: This isn't the regexp you're looking for.
Stormtrooper: This isn't the regexp we're looking for.
Obi-Wan: He can go about his BizTalk.
Stormtrooper: You can go about your BizTalk.
Obi-Wan: Add SQL and Stir.
Stormtrooper: Add SQL ... Add SQL.

Luckily, in episode 7, the whole thing is rewritten in Elvish -- a far more appropriate dysfunctional language.

Re: Jed Code

2008-03-28 14:57 • by shazam (unregistered)
The Real WTF(tm) here is that the poster didn't tell his manager "I think I can fix it and make it run 20% faster if you give me 2 weeks to work on it". He could then write the loop, make it run a million percent faster, browse the web for 2 weeks, and greatly exceed his goals and score a nice bonus.

Re: Jed Code

2008-03-28 15:07 • by iMalc (unregistered)
Clearly someone had told him that conditional branches were slow and should be avoided at ABSOLUTELY ALL costs!

Re: Jed Code

2008-03-28 15:12 • by Ikasinuk (unregistered)
186645 in reply to 186629
k:
I thought the title of the article was "Jedi Code", and was expecting some sort of "These aren't the variables you're looking for" reference.
Whew, I'm not the only one.

Re: Jed Code

2008-03-28 16:28 • by cam (unregistered)
Hey, to all you future wtf'ers, I really appreciate how he explained how he fixed the problem. as a cs student its nice to know what not to do!

Re: Jed Code

2008-03-28 16:56 • by SuperC142 (unregistered)
This could only have been better if you subsequently discovered a (looping) program he wrote to generate the source code.

Re: Jed Code

2008-03-28 17:11 • by Jed the third (unregistered)
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 :)

Re: Jed Code

2008-03-28 17:36 • by Prove that you're not a robot (unregistered)
186663 in reply to 186601
Why is nobody commenting on the fact that he retrieves all rows just to get row counts?

I rewrote the report to use a simple GROUP BY query

There you go
« PrevPage 1 | Page 2Next »

Add Comment