Discussion
Inspired by the old Ramones song and a plethora of posts on Indian Coders thought I'd start up a thread on the stupidist examples of coding you've seen.
I'm currently wading may way through about 30,000 lines of Java created to the standards we all know and love. Here's a few to get us started.
pmsl
Feckin piceless! don't you just love the fact that even though we 'should have never come here' they don't raise an exception nor create an alarm and still go on to do stuff anyway.
Ahhh gotta love em'
best
Ex
I'm currently wading may way through about 30,000 lines of Java created to the standards we all know and love. Here's a few to get us started.
IndianCoder said:
try
{
_runQ.addObject(ret_obj);
}catch(HHMEException he)
{
debugLog("HHMEException: While Adding to the RunQ" );
String eMsg = he.getMessage();
debugLog("" + eMsg);
}
pmsl
IndianCoder said:
//AN SNMP GET OBJECT COMES HERE THE FIRSTTIME IT COMES INTO THE RUN QUEUE
case SNMPState.WAIT_GET_RESPONSE:
debugLog("process(): MAKING THE NEW SNMP GET OBJECT AND PUTTING IT INTO THE PENDING QUEUE.....SHOULD HAVE NEVER COME HERE");
sigObj = (SnmpGetObj)clone();
i = ObjProcessStatus.OUT;
v.addElement(new ObjStatus(i,sigObj));
sigObj = this;
i = ObjProcessStatus.PENDING;
v.addElement(new ObjStatus(i,sigObj));
debugLog("process(): GET OBJECT IS IN PENDING QUEUE and WAITING FOR SNMP RESPONSE ");
break;
Feckin piceless! don't you just love the fact that even though we 'should have never come here' they don't raise an exception nor create an alarm and still go on to do stuff anyway.
Ahhh gotta love em'
best
Ex
Liszt said:
Best I saw was
Indian Coder said:
If 1 = 1
perform A0-Subroutine-name
end-if.
there are times when you can use that, or so i've been told... the explanation went over my head.
Worst I saw was
IF subrc = 0.
perform subroutine A.
ELSEIF subrc <> 0.
perform subroutine A.
ENDIF.
Usually it's the complete and utter lack of testing or basic understanding of what a development is trying to do that crack me up.
Once opened an attached test result file which should have shown the successful output from a report. He'd actually run it and then attached a screenshot of the subsequent short dump. And then signed it off!
Chris_w said:
Worst I saw was
IF subrc = 0.
perform subroutine A.
ELSEIF subrc <> 0.
perform subroutine A.
ENDIF.
Usually it's the complete and utter lack of testing or basic understanding of what a development is trying to do that crack me up.
Once opened an attached test result file which should have shown the successful output from a report. He'd actually run it and then attached a screenshot of the subsequent short dump. And then signed it off!
Man I need to wipe away the tears... that is so funny!
and I completely agree.... They aren't paid to think they're just code monkeys and if your detailed design isn't up to scratch then you just get poop in return.
I've found heaps more today
indian coder said:
// from some radius code
if(avp == null)
{
debugLog("AVP was null");
}
Encoding enc = avp.getEncoding(0x51);
For those that don't know coding too well this snippet code begins by checking to see if the data structure called 'avp' actually exists or not (==null). If it is null then a line is written to the log indicating theat the data structure doesn't exist. Then lo and behold they attempt to retrieve the Encoding data from the non existent avp!
Needless to say that error would bring the system down in a hurry, I think the nearest try/catch block was in up in main somewhere!
indian coder said:
if(n!=1)
{
.. do sumfin...
}else{
// should not come here
}
Quite astonishing!
I think you lot would enjoy a visit to
www.thedailywtf.com
Where I should have posted this:-
www.pistonheads.com/gassing/topic.asp?t=121518&f=95&h=0
enjoy..
Paul
www.thedailywtf.com
Where I should have posted this:-
www.pistonheads.com/gassing/topic.asp?t=121518&f=95&h=0
enjoy..
Paul
Ex, Java is a nightmare because of the reference model evangelists. My usual quips are " off you twats, I've spend shed loads of money on an app server made by vendor X, an RDBMS by vendor Y, this ain't gonna change in a hurry"
and "don't give me any shit about DB performance tweaks, there's little I can do when you write shite like
SELECT *
FROM fecking_big_table
WHERE somerow NOT IN (SELECT somerow FROM fecking_big_table)"
Oh lord, the number of wheel reinventions I've seen in Java. But hey, lines of code = money.
In my PLSQL days the classic was
DECLARE
-- stuff
BEGIN
-- stuff
EXCEPTION
WHEN OTHERS THEN
NULL;
END;
To those uninformed this basically says in the event of an error, do nothing, carry on regardless.
Now, to be fair there are some occasions why you want to do this, but I've seen far more people use it because they no nothing else.
And here's me thinking that the .com bust had rid the market of useless overpaid contractors, ho hum.
As they say, can't beat em....!!
Steve
and "don't give me any shit about DB performance tweaks, there's little I can do when you write shite like
SELECT *
FROM fecking_big_table
WHERE somerow NOT IN (SELECT somerow FROM fecking_big_table)"
Oh lord, the number of wheel reinventions I've seen in Java. But hey, lines of code = money.
In my PLSQL days the classic was
DECLARE
-- stuff
BEGIN
-- stuff
EXCEPTION
WHEN OTHERS THEN
NULL;
END;
To those uninformed this basically says in the event of an error, do nothing, carry on regardless.
Now, to be fair there are some occasions why you want to do this, but I've seen far more people use it because they no nothing else.
And here's me thinking that the .com bust had rid the market of useless overpaid contractors, ho hum.
As they say, can't beat em....!!
Steve
gopher said:
I think you lot would enjoy a visit to
www.thedailywtf.com
Where I should have posted this:-
www.pistonheads.com/gassing/topic.asp?t=121518&f=95&h=0
enjoy..
Paul
stop stop stop
it hurts......
this is my particular favourite becuase the vender who did not know the significance of the & in query strings also did exactly this :-
http://thedailywtf.com/archive/2004/07/22/649.aspx
http://thedailywtf.com/archive/2004/07/22/649.aspx
fatsteve said:
Adrian, that's priceless.
The article about Java and XML brought back some memories!!, why use a SAX or DOM parser when you can use string concatenation to build your XML and substr to decode/parse it..!!
Steve
Utterly OT but after the day I've had I think I deserve it. That pic on yer profile minds me of a time in a field in Lincolnshire after we'd been chased by BiBs with copters and dogs all night.
Eventually the pills kicked in (we'd necked em all for fear of being arrested) and collapsed in a corn field to watch the sunrise.
Looked just like that field in the picture, only with corn and ummm no car, if you get what I mean.
best
Ex
>> Edited by TheExcession on Wednesday 8th September 00:27
fatsteve said:
Ex, Java is a nightmare because of the reference model evangelists
Yup - sucks ass.
Seems that '&' gets up everybody's nose.
Lost count of the number of C programs that don't work coz someone forgot that you need need to pass the pointer address and not its contents!
I've been doing Java for a long time now and really have to switch brain mode if I need to get back into C.
I kinda miss pointers, and managing your own memory along with managing that of the computer. Kept you on your toes.
It's way too easy to churn out sloppy shite code nowadays, and get away with it.
And don't get me onto XML - jesus feckin H khrist what the is that about? Try explaing to someone who is paying $20 per megabit for a satellite link that XML was a smart move.
Then contrast that to SNMP's BER where OIDs are encoded in 6 bit ASCII.
Makes my blood boil!
hehehehe
best
Ex
Gassing Station | Computers, Gadgets & Stuff | Top of Page | What's New | My Stuff