Friday, November 9, 2007

Trial And Error, Not Precisely The Best Alternative

All right, trying to learn a new technology all by yourself may not be the easiest thing in the world, but when you've developed java applications of almost any kind, learning to use a new API isn't really complicated. What actually makes it complicated is not taking a few hours to RTFM!!!

Once I realized I had the ability to write some code, compile it and run it in the Wireless Toolkit simulator I just jumped right into the development stage. Wrong idea !!!

MIDP is not a huge/complicated API. However, I strongly recommend reading as much information about the usage of the basic classes and specially about the best practices involved. Getting a good idea of when to use separate threads; when to use a Canvas, a Game Canvas or a Form; when to implement CommandListener and where... these are all things you should know about before starting your project.

I ended up writing a complete mess, then wisely decided to start over, managed to write another mess even bigger, once again wisely decided to start over and finally came up with a decent implementation. The first two attempts did work, they showed the game and allowed you to play, but moving from one Canvas to another or handling user commands was a complete pain. The third attempt on the other hand was very very clean, with very few lines of code and allowed me to add features and change the behavior of the game very easily.

There's just one thing I still don't understand... Why haven't I read about the things I'm suggesting to read?

No comments: