Indian Giver

Author
Discussion

TheExcession

Original Poster:

11,669 posts

250 months

Tuesday 7th September 2004
quotequote all
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.
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


Marki

15,763 posts

270 months

Tuesday 7th September 2004
quotequote all

Liszt

4,329 posts

270 months

Tuesday 7th September 2004
quotequote all
Best I saw was
Indian Coder said:

If 1 = 1
perform A0-Subroutine-name
end-if.

FourWheelDrift

88,542 posts

284 months

Tuesday 7th September 2004
quotequote all


I don't understand a word of it but the punchlines are good.

docevi1

10,430 posts

248 months

Tuesday 7th September 2004
quotequote all
FourWheelDrift said:


I don't understand a word of it but the punchlines are good.
me neither and I study Java at Uni

_dobbo_

14,382 posts

248 months

Tuesday 7th September 2004
quotequote all
docevi1 said:

FourWheelDrift said:


I don't understand a word of it but the punchlines are good.

me neither and I study Java at Uni

My programming started and ended on the BBC Mircos in our school library:

10 PRINT "The Librarian eats poo"
20 GOTO 10
RUN

hee hee.

Chris_w

2,564 posts

259 months

Tuesday 7th September 2004
quotequote all
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!

stin hambo

627 posts

237 months

Tuesday 7th September 2004
quotequote all
I remember the PEEK and POKE commands on the Spectrum... So you could break the sequence unless you unplugged it!

TheExcession

Original Poster:

11,669 posts

250 months

Tuesday 7th September 2004
quotequote all
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!

gopher

5,160 posts

259 months

Tuesday 7th September 2004
quotequote all
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

fatsteve

1,143 posts

277 months

Tuesday 7th September 2004
quotequote all
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

TheExcession

Original Poster:

11,669 posts

250 months

Tuesday 7th September 2004
quotequote all
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......

fatsteve

1,143 posts

277 months

Tuesday 7th September 2004
quotequote all
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

gopher

5,160 posts

259 months

Tuesday 7th September 2004
quotequote all
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

fatsteve

1,143 posts

277 months

Tuesday 7th September 2004
quotequote all
Ouch, HTML literals in a query, nasty

TheExcession

Original Poster:

11,669 posts

250 months

Wednesday 8th September 2004
quotequote all
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

TheExcession

Original Poster:

11,669 posts

250 months

Wednesday 8th September 2004
quotequote all
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

rebelstar

1,146 posts

244 months

Wednesday 8th September 2004
quotequote all
I agree. XML needs to be taken out and shot. I mean, why do so many companies insist on using it in new projects regardless of fitness for purpose? Better stop now or I'll be ranting too...

BliarOut

72,857 posts

239 months

Wednesday 8th September 2004
quotequote all
Don't shoot me, but what's so bad about XML?

It's not such a dumb question if you don't know the answer!!

plotloss

67,280 posts

270 months

Wednesday 8th September 2004
quotequote all
XML if used correctly is probably the most powerful iteration in computing since client/server.

Problem is fundamentally with marketeers who attach XML to compliance to bloody everything.

For interoperability there is nothing better IMHO.