During my J2ME porting & localising endeavours I’ve come into contact with some unbelievably bad code.
Is it just the norm? or is J2ME particularly well off in terms of bad coders?
Lets see some of the abominations you peeps have come into contact with too
Heres a few to get started :-
Thread Thread = new Thread(Thread());
And it even compiles :d
public static Graphics CurrentGraphics;
public void paint(Graphics g)
{
CurrentGraphics = g;
}
When you see that, you know your in for a porting nightmare :S
Line 300: public void doGame()
{
...
...
Line 2300: if(a<q & d>=j) return;
...
...
Line 4571: if(true) return;
...
...
Line 6784: }
Nothing like methods that span 25 pages, have misc returns throughout, and have huge areas of dead code.
public void save_LOAD_data(boolean b)
{
....
}
save/load pah, its all the same - lets chuck both in the same method!
Naming convention? what naming convention!
CONST_STR_5 = 7 - 3;
This is a personal favourite of mine
and suprising how often you see it!
FILE_LENGTH--;
I like changing constants too! o_0
class Game
{
public static int i,j,l,z,x,k,y,v,w,j;
......
}
Death used to terrify me, now it seems like a peaceful escape from the horror of tracing bugs in programs like the above =/
switch(a)
{
case 1:
return 2;
case 2:
return 3;
case 3:
return 4;
default:
return a+1;
}
Must… Kill… Incompetent… Eastern… European… ‘Coders’
public static final int SCR_WIDTH = 128, SCR_HEIGHT = 160;
.....
g.drawImage(img, (128-14)>>2, (159-26) >>2, g.TOP | Graphics.LEFT);
Constants are such a good idea… but using them all the time? that would just require too much effort!