29 October 2007

Pain can be useful

So, I've spent a few hours improving my little J2ME project. It's pretty much done, what I need now is a little bit of polishing and, more importantly, the server-side app, which I just started to "conjure up" in django.

I didn't remember how painful Java development can be. Fixed-size arrays, .put() and .get() every five seconds, loads of redundant declarations (if a method can only return a String, why should I also declare that a reference to the result is of type String? what else could it be?), not having an interactive environment to quickly test out ideas. Eclipse goes a long way to reduce the pain, but it's still so much more painful than doing the same thing in Python. And when everything is done... NullPointerException.

The good side is that fear of pain forces you to really think things through before you write them down. In Python, I end up re-writing things over and over again, because there's no (perceived) penalty in doing it, and I more or less "code my thoughts"; of course, I eventually end up spending lots of time on this sort of messing.
With Java, I'm forced to think about the proper structure up-front, because I dread having to write it down more than once; but this means that it's then a matter of monkey-coding a clear structure, and once it's done, it's done, and I can get on with other things.

4 comments:

  1. Variable size arrays in Java are called ArrayList. I suppose J2ME supports that.

    An interactive interpreter is indeed extremely useful. Check DrJava out: it is an IDE but with a REAL interactive Java console.

    ReplyDelete
  2. nix, ArrayList are not available in J2ME. You can have Vector though, and Hashtable, but functions will more or less all return arrays (probably because of memory limitations and bla bla bla Java 1.1 bla bla bla).

    Thanks for the info about drJava, i'll check it out... even though I notice it doesn't support J2ME :(

    ReplyDelete
  3. This comment has been removed by the author.

    ReplyDelete
  4. re ArrayList not in J2ME, I'm shocked.

    re DrJava, I use it only as an interactive console to do some experiments. I still do Java programming in Eclipse. If you fancy it, there even is a DrJava plug-in for Eclipse. (It's a pity that the DrJava website was designed by an idiot who thought frames are cool.)

    ReplyDelete