- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
Is this some of that new-fangled "No SQL" stuff?
Admin
Actually, they reprimanded him for making $BOSS->$BOSS->Offspring[1] (aka "the brilliant programmer who wrote the original code") look bad.
Admin
I used to work for a company where every access to the data was done like in this example. Foreach, foreach, foreach... So slow that showing the contact details of about 400 people took half an hour. In my case, unfortunately, I was forbidden to make any change, because "they always did like that". Solution was: customer will wait.
Oh, and their "caching" solution, of fetching an arbitrary amount of records before and after the requested one, just in case...
Admin
FTFY (Username) ;)
Admin
I'm the type of developer that likes to do a lot of things in the program's code and keep the SQL as simple as possible, but even I'll have to admit that this code sample is a little overdone in that respect.
Admin
Sadly it's not always an option to use sql when the data is stored in memory in a structure like this.
Admin
Admin
TRWTF is the programming language you seem to be using.
Admin
That was only after several demonstrations showing that the output was, in fact, correct, because if it's running that fast, how can it actually be doing it right?
Admin
The ending to this one is rather refreshing.
Admin
There is a place for everything; sometimes it is far better to off-load the work to the SQL server, and sometimes it is better to use the compiler.
Admin
What management would not want proper testing to show them that the end result is still the same?
Admin
Clearly, TRWTF is that Chris didn't save his fix and dole it out slowly over a year. Imagine if every month he removed just one for loop and slightly expanded the SQL? Instead he blew his wad on a single fix! Amateur.
Admin
Premature optimization? Don't they have a medication for that?
Admin
Of course, it would be surprising if management figured out how to test the new report to make sure it's correct. I'm sure someone complained that it didn't match the old report.
Admin
Ask your doctor if Optimator is right for you. And remember, IT advice should be sought immediately for report generation lasting more than four hours.
Admin
TRWTF is that if he had simply used simple stored procedure, he would have save even more time.
Admin
Holy crap, it's like a taco inside a taco inside a Taco Bell inside a KFC in a mall in your dream!
Admin
+1
Admin
Reminds me of an XML horror I encountered a while ago. Rather than make sane of selectNodes(), firstChild() etc., a now ex-colleague in another country decided to iterate over every single node in the DOM, checking each to see if it was the right type. On finding a node of interest, he then iterated over every node in the tree again, checking each to see if it was the (only) child of the original. On finding the child, he then continued to check that all the remaining nodes definitely weren't also children.
And for every query into the DOM, he'd read and parse the whole thing from file again...
Completely coincidentally, the very day he proclaimed to the CEO that the startup of the complete system was "already as fast as it could be" was the same day another colleague and I spent an afternoon looking at the problem and knocked 90% off the time by altering that single function.
Admin
In my experience, from both observed and personally-executed, this type of behavior usually occurs when somebody is first learning XYZ technology. As far as they know, they are doing the Right Thing (TM), and as far they know, it probably is as fast as it can be, given how it was implemented. As they say, or as I say, if it isn't broke, optimize it! :)
Admin
Hmm...
A quarrelsome quest for questionable queries! A quotidian quagmire quickly makes quad-cores querulous. But quality code quashes quackery.
Let's quit and quaff!
/14 layers of queues?
Admin
Admin
Quit it.
Admin
Did they find the original programmer who wrote that logic?
CAPTCHA: dolor - This makes me sad.
Admin
This is either Perl (which I don't know much about) or PHP (which I used before it got all this fancy OO stuff). Either way, I don't think the second $BOSS should have $, but I could be wrong.
Admin
Admin
You need to go deeper!
Admin
Admin
Perhaps the original developer didn't approve of the project's selection of database software/vendor? I've seen this behavior before; a developer refuses to work with the database, so his act of "rebellion" is basically doing the database's job on the app side.
It's sad, really. Sad, and funny.
Admin
In recognition of the developer saving the company thousands of dollars in lost productivity, Management has graciously approved the award of verbal praise for the developer.
Next item on the agenda: How to solve the persistent morale problem in the IT department. Should we just fire the unhappy ones?
Admin
Admin
What I want to know is how do you make time to refactor code like this? Every job I have worked at has always kept us developers swamped with "new" work and we are never allocated time to go back and fix things as the rule is "There is ALWAYS something to do"
My current job could do with a fair bit of code cleanup but there is no time allocated. Should I pretend to take longer on other assigned tasks and use that time to refactor some code or develop a proof of concept to demonstrate how some things can be done better than they are currently?
Admin
Admin
I thought this story was going to be about Taco Bell's new 2 burrito value meal, AKA the number 14.
Admin
They call that an "exit interview".
Admin
I think it's more likely some kind of shell (sh, bash,...). $BOSS, $DEITY,... it's a recurring "joke" in the linux world.
Admin
Well, since it's established that time scales upwards by a factor of 20 with each level -- at 14 layers deep, you just about do have an eternity to run (an approximate multiplier of 1.6E18).
Admin
One that was willing to employ the cretin who perpetrated the first version, perhaps?
Admin
This is what happens when a self-taught VB programmer teaches himself SQL.
Admin
Yo dawg I heard you liked foreach so I put a foreach in your foreach so you can foreach while you foreach
Admin
I did not post this comment. Someone out here is mkaing fun of me.
Admin
Did he sue you afterwards?
CAPTCHA: populus - the state of my state.
Admin
Admin
Fake frits just can't help himself: he invented yet another altar-ego.
Admin
Maybe the original programmer had just seen Inception and was trying to reach Limbo.
Admin
Nah, it happens. (It helps if the previous programmer isn't around anymore, though.)
The trick is to make the fix the "new work". Get the people who use that report to send a request up the line asking if there's any way to make the report run faster. Get them to mention how much time/money/hassle they will save if the report was better. Cc liberally.
Admin
1-minute difference...same guy?
Admin
I'm not sure about PHP, although it's generally less tolerant of interpreting a random string of characters as a program than Perl is, so I suspect it's invalid in PHP too.
Admin