Sunday, January 08, 2006

Stupid Java Programmers

** Programming savvy is a prerequisite to understanding this post **

I'm a Java programmer and I love programming in Java. In fact I got myself certified last year. I'm now offically a Sun Certified Programmer for the Java Platform, SE 5.0! Bow before my 1337 hax0r Java skills ^_^

Hehe... okok... the point of this post is not to glorify myself but rather I want to show you some code snippets from a project that I had worked with some time ago. I didn't write the following codes but I sure as hell had to understand and clean them.

The programmers originally hired to work on the project were foreigners from an Asian country that's currently making waves all over the world with their rapidly growing Information Technology industry. I suppose you know which country I'm talking about. Please understand I'm not trying to say that they're all bad just that there are those who are truly so bad that you wonder how they managed to become a programmer at all.

When me and a friend were drafted to join (actually a better word would be save) this project, two of the original programmers were still involved. They were a guy and a girl. The guy was the principal developer and he was responsible for writing 95% of the software. The girl was given the menial task of writing templates for reports.

A short period after me and my friend joined the project, the principal developer decided to run away. He said he had to go back to his home country to attend his sister's wedding and return to the project after that. Well he left and we saw him on Yahoo messenger once. We asked him where he was and when he was coming back. He said he was hospitalised. Hmmm... instant messaging in the hospital. Sounds really fishy. Anyways that was the last any of us ever saw from him. He left us a pile of crap to sort out.

The girl developer wasn't much help. She wasn't really involved in the development process at all so our manager decided to let her do the menial tasks... things like adding in logging and error handling. But even then she screwed up the codes a few times and introduced some bugs. It became a habit of mine to check her commits to see whether she screwed up anything and every other day she did! Sigh.

Ok enough about them. During the project, I maintained a list of some of the more atrocious code that the original programmers produced. The list isn't that long because I wasn't persistent in updating it so enjoy a small sample of their head scratching programming (in no particular order):

1. improbably stupid way to initialise an int
int key = 0;

try {
key = Integer.parseInt("002");
} catch(NumberFormatException e) {
}

2. super redundant if statement
String resultSQL = "";

if(batchNo > 1) {
resultSQL = "select " + fields + " from TABLE where status='N'";
}
else {
resultSQL = "select " + fields + " from TABLE where status='N'";
}

3. error handling with (very possible) infinite loop!
public void check( int count ) {
try {
// some JDBC codes
} catch( Exception e ) {
e.printStackTrace();
check( count );
}
}

4. the ultimate useless method
public void getSomeData() {
String someData = someDataTxtField.getText();
// yes! that's all there is to the method
}

5. obviously never learned Java basics
import java.lang.*;

// the rest of the class

And in case your wondering... all the codes above are true. I just changed the variable names and hid the non relevant parts. Imagine working with these kind of codes everyday... it's a killer. Thankfully we managed to complete the project and delivered it succesfully.

posted by wyejon at Sunday, January 08, 2006 (permalink) |

22 wise words from our readers:

a golden opinion from Blogger Dragon City

wtf... this prove that we Malaysian are better..but overwork and underpaid because of those "3rd grade robber" who came to our country. For case 1 and 4, mayb he use some sort of buggy IDE to generate it...lolz

8:16 PM  

a golden opinion from Blogger wyejon

tung: hehe... like I said they're not all bad. Some of them are quite good. Buggy IDE? No way. They have a buggy mind ;p

11:59 PM  

a golden opinion from Anonymous bala

I agree with wyejon. As like any other lot, there will be some bad, good and few exceptionally good fruits.

Dragon city,

>>"This prove that we Malaysian are better."

This is an instance of what is called the logical trap of hasty generalization.

I am an Indian national working here for the past few years. I have worked in the following countries(India, US, Singapore and Japan) for about 7 years. Do you want to know which country has more number of terriable programmers as per my experience?. I bet you guessed by this time.

I can show you lot of idiotic programmers from Malaysia, with whom I worked and still working.
To give you an example,

When I was working with a leading mobile operator in Malaysia, I was the solution architect of the project. After given UML diagrams and specifications to each developer, this Malaysian girl (senior sofware programmer -5yrs experience) came to me asked "Is it possible to have 2 while loop and 1 for loop in that x method". She doesn’t even know, we can have any number loops given if it is required for that method's logic.


"but overwork and underpaid because of those "3rd grade robber" who came to our country."

I can understand your frustration of getting underpaid. To understand this new world, here is a thought experiment. How Malaysian economy is doing well, without any exports? Malaysia is exporting US$19 billion dollars palm oil to India per year. As an Indian can I call it robbery in large scale? It is not. It is just competition.

And finally my question to you, when he is a 3rd grade (as per you) why the hell you hire him? Unless you hire him and provide visa, how can he come here to rob you?

11:58 AM  

a golden opinion from Blogger Dragon City

dear mr.bala

I’m only 50-50 agreed with you. Talking about the Malaysian senior engineer who asked you the question I personally think that she just want to get some confirmation from you as you know there was coding standard in a lot of MNC company. I’m not sure you as “SOLUTION ARCHITECT” of some “LEADING MOBILE OPERATOR” company are using this kind of standard. Oh ya, I forget that none of our mobile service provider here at Malaysia is MNC.

At least she asked for your opinion on something that she not sure about, not like your country mate who just simply go and initialize an int in a damn brilliant way.

And about the underpaid, sorry, I’m not frustrated of it coz I’m not underpaid and I’m happy with my income. The problem is I’m not happy with “3rd grade robber” who came on the good reputation of their country and getting well paid but in return give us a piece of shitty code.

Anyway I admit that there was some good and excellent engineer from India as I have work with some of them in the past. That’s why I great them as “1st class engineer” not “3rd grade robber” like who wrote the stupid code.

1:33 PM  

a golden opinion from Blogger wyejon

dudes... calm down... laugh at the stupid codes i posted instead :)

1:42 PM  

a golden opinion from Anonymous bala

Dragon city,



Let me make it clear, I am not supporting that guy. I was just merely pointing out that your point "this prove that we Malaysian are better" is a good example hasty generalization.

I think you missed the point at the 2 while loops and 1 for loop issue.

Here is what happened after that conversation.

After few weeks, that code failed in UAT, she told the code is written by her but bala only told that we can have 2 while and 1 for loops in a method then how can it fail. She argues that, having 2 while loop and 1 for loop is the reason for that failure and as that is suggested by me ,so that error is because of bala. That foolish argument took my breath away.

I am currently attached with a MNC, to tell you the truth programming or coding standard here is worse than the mobile operator, But the same MNC is a CMM 5 level MNC in india.

If I am not mistaken, companies are not hiring a person just because he is from this X country. If that is the case the mistake is with the companies, not with the so called robber(s).

2:54 PM  

a golden opinion from Blogger wyejon

I was checking my site stats today and I found an unusual amount of referrals from Yahoo Mail. I traced it to this post.

I've got a feeling that this post is being circulated amongst some foreign programmers and if you're feeling insulted by this post in any way... please don't be.

Both Dragon City and Bala have good points and believe it or not both are correct on most points.

The fact is that stupid people exists everywhere and myself and Dragon City have had some nasty experiences with foreign programmers. However like I mentioned earlier I am also aware of many skilled foreign programmers and my hat is off to them.

This can potentially become a deep and meaningful discussion but I have no wish to do so in my blog. As you can see it is a very light hearted blog and such talk does not belong here.

Thanks for reading. Have a nice day.

9:34 PM  

a golden opinion from Blogger MoonCake

I'm a Java programmer and I love programming in Java. In fact I got myself certified last year. I'm now offically a Sun Certified Web component Developer for the Java Platform, EE 1.4! a level ahead of Jon :-D

Hehe... okok... the point of this post is not to glorify myself, i was the other friend of him doing on that project, I've been working with bunch of "those" programmers and i do admit that all of them have buggy mind, their coding really put me into nightmare.. man.. how can these bunch of ppl be a programmer, wat's wrong with this company ? Why are they hiring them ? Why they left tat pile of shit to us... hollyshit ... Thank god that we managed to get it done on time, appreciate jon's hardwork.

12:15 AM  

a golden opinion from Blogger MoonCake

btw, all my friends working as java programmer are lot more competent those "programmers"... without them, our project will definately failed. I thank god for my company wise decision to get rid of all those "programmers" and get replaced by all malaysian programmers... Bala, I do admit some of your point but not all. BTW.. those code that jon posted are the worst code i ever seen i nmy programming lifetime. Somemore the technical leads claimed that he has got 7 years of experience in programming, I doubt that he is referring to non-java programming experience... anyway.. wat I'm pissed of with is that guy ran away by cheating us that he will be back... me and jon spent days and nights to clean up those shits..... man. i hope i will never have to work with these bunch of "programmers" anymore in my lifetime..... amen.

12:25 AM  

a golden opinion from Blogger MoonCake

correction..

I doubt that he is referring to non-java programming experience

suppose to be

I doubt that he is referring to java programming experience, maybe he has 7 years of java knowledge, but with no real life experience in programming

12:27 AM  

a golden opinion from Blogger wyejon

mooncake: don't generalise... there are excellent programmers from that country. We just happened to work with the worst of them.

9:19 AM  

a golden opinion from Blogger Seymour Cakes

First, congrat Jon, fuwoh... JCP 5.0 man *clap* *clap*

By the way, I have been reading http://thedailywtf.com/, I'm kinda numb over craps like these.

Damn, I miss Java.

9:23 AM  

a golden opinion from Blogger wyejon

sey: that's a very funny website :)

9:28 AM  

a golden opinion from Anonymous bala

mooncake,

It seems you guys read lot in between lines. Let me make it clear again.

I am not saying all indian programmers are good in programming. There was a comment from dragon's comment that ".... proves that we malaysian are better". I just not accepting that argument. Why more examples?. Not required man.

If you met lot of unskilled indian programmers, is that my problem?. It is your stupid company which hired them. Do you guys do interview before taking guys or just hire them by seeing their resume. May be because your company was tempted by their low salary.

Here is my point: If you disagree with this point, then you discuss with this point. Dont bring anything else which I didn't say.

1. I am saying "Not all malaysian programmers are better in programming". It goes to indians too. Not all of them are good.

2. Hiring those kind of programmer is mistake of the company, not those so called "3rd class rober".

These are my points. Do you have issue with that?.

1:08 PM  

a golden opinion from Blogger Seymour Cakes

Mr Bala, Mr DragonCity, and the rest of you,

Saying who is better is a futile attempt to flex the ego muscles. As you and I know that, there are good and bad programmers everywhere, regardless of race, age, and nationals. Most of the time, it doesn't matter a shit; and the rest of the time, it stirs sentiments like throwing shit to the fan.

Why don't ya guys head over to http://thedailywtf.com/ and have a good laugh. Yes?

C'mon ...

4:39 PM  

a golden opinion from Blogger Bala Murali

seymour cakes,

I am more or less saying the same thing if you read all my commments of this post.

6:29 PM  

a golden opinion from Blogger David

wow, your'e so lucky to work with people like that Jon :P

10:30 AM  

a golden opinion from Blogger wyejon

david: yeap... i wished i worked with these people more often... i could open up my own daily wtf website :)

12:32 AM  

a golden opinion from Blogger Chorwin

Hi wyejon, I like to visit your blog when either McDonalds or KFC came out new stuff. Sure you will went to taste it! haha ^ ^
For the number 1, improbably stupid way to initialise an int, i did agreed with it. What for to catch for an error after declare =0... confusing.
for the if statement, It still acceptable as this depend on programming habit, some people really get used to the {}
3, may be accidentally delete the check code..... huh!!
4, agree with u, very stupid.
5........ mmmm... mmmm.....(@#$&)

9:54 AM  

a golden opinion from Blogger wyejon

chorwin: hehe... thanks for visiting :)

dude... i'm not sure if you caught some of the points i was trying to make so i think better i explain a bit (for other readers as well) :)

for #1 he's catching the error because in Java when you cast a String to an int it might throw a NumberFormatException. By right if he wanted to assign the value of 2 to the variable key he should have just wrote "int key = 2;". Casting a String literal to an int is plain silly.

for #2 if you look closely the code inside the 2 conditions are exactly the same! This means there is no need for the if statement at all.

for #3 he's catching an exception that occured in the check() method and then calling the same check() method again. It's possible that the same error will occur and the program will end up going through an infinite loop of errors.

#4 is plain silly. He's getting the String value inside someDataTxtField which is a JTextField object and storing it to the variable someData. Unfortunately the scope of the variable someData starts and ends within the getSomeData() method. This variable cannot be accessed elsewhere making the whole assignment pointless.

#5 is really dumb. One of the first lessons I learnt in Java is that the java.lang package is automatically imported for you by the compiler. What I didn't write down is that the programmers also had a habit of declaring Strings as "java.lang.String aString"!

10:09 AM  

a golden opinion from Blogger Seymour Cakes

I just got me a cool book, My Job Went To India (and all I got was this lousy book)

2:07 PM  

a golden opinion from Blogger Chorwin

Wow, you truly Java expert!
Anyway, I more to C++ ^_^

9:57 PM  

Post a Comment

Trackbacks:

Create a Link

<< Home

My Photo
Name: Wye Jon Lee







www.flickr.com
This is a Flickr badge showing public photos from lee wye jon. Make your own badge here.




SARA Top Food & Drink Blogs Blogarama - The Blogs Directory Blogged.my wyejon's Profile on Ping.sg  Planet Malaysia

random avatars
template: double-u-pee v2.0b017
author: lee wye jon
updated: 11 Aug 2006
© wAntAn productions, 2006



This page renders best with Mozilla Firefox.