Indian Giver

Author
Discussion

TheExcession

Original Poster:

11,669 posts

251 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


TheExcession

Original Poster:

11,669 posts

251 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!

TheExcession

Original Poster:

11,669 posts

251 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......

TheExcession

Original Poster:

11,669 posts

251 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

251 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

TheExcession

Original Poster:

11,669 posts

251 months

Wednesday 8th September 2004
quotequote all
pdV6 said:
After completing the job, we subsequently discovered that what they'd done is simply hide the old interface, bolt on a new one to accept XML and then written code to translate the XML into a format suitable to be passed to the old "hidden" interface behind the scenes.

lmfao
They weren't Indians by any chance were they?



>> Edited by TheExcession on Wednesday 8th September 13:35

TheExcession

Original Poster:

11,669 posts

251 months

Wednesday 8th September 2004
quotequote all
BliarOut said:
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!!


There are no stupid questions, just stupid people

plotloss said:
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.



In pricipal it's great as plottloss has sugested any thing that by its very nature is extensible has got to be a good thing, but to me, at protocol levels it's just too heavy.

It's like I said before - why write one line of code when you could write three.

I cut my teeth in IT writing SNMP stacks and defining MIBS. These are just as extensible as XML - the difference being that in the 'those days' every bit on the wire counted for something and had a cost attached to it.

In my field these principals still hold true.

When I see XML stream down the line it just irritates the out of me - especially when my customers are charged by the bit/byte.

Look how long it's taken for HTTP to adopt a compression scheme, and still a very large number of sites are ignorant of its benefits and don't routinely use it.

I spent months hacking the Apache Proxy Server module to provide a system where our customers who ran an HTTP1.1 capable browser were guaranteed to get compressed HTTP data regardless of what pants the upstream server might be doing. This system generally cuts their satellite bills by around 40% - so many sites just don't stream compressed data.

It drives me mad, in this day of 1Mbit pipes into your bathroom, bedroom and garden shed no one seems to give a shit about what goes on the wire anymore?

Imagine how much faster the Internet would be if everyone would adhere to these principals?


best
Ex





>> Edited by TheExcession on Wednesday 8th September 13:36

TheExcession

Original Poster:

11,669 posts

251 months

Wednesday 8th September 2004
quotequote all
plotloss said:
True, but by that same token paying an EDI firm everytime you send a transmission was patently an unsustainable model.

I just wish people would get their act together over schema versions and inclusions.

Even after almost 5 years IBM, MS and W3C cant agree on which version of SOAP is the best one...


Yeah, and remember lots of these wonderful inventions began life as a project by some spotty oink at university.

Education has a lot to answer for

Still, all in the name of progress I guess.


TheExcession

Original Poster:

11,669 posts

251 months

Saturday 11th September 2004
quotequote all
fatsteve said:
XML (like all technologies) has it's place and it is very useful. However the overhead of repeating your metadata is high.

I've recently worked on project where it was deemed better to extract data from a db into XML messages, stick them on a MQ hub, read them off the other end and write the data to a different db. Now given that both DB's were the same vendor and version (Oracle 9.2.0.1 fwiw), why they didn't just use a db link is beyond me.

Steve

Consultants making their money?

It's funny how you can get a few people together to sort a 'problem' and only then begin to discover where the motives really lie.

Personally I'd rather work on something new but time and time again I see people reinventing the wheel simply because it pays their wage.

Still, in this case I could be wrong, maybe they just didn't have a clue what they were doing.

best
Ex