Java - initial impressions

Over the last little bit I’ve been digging into Java and exploring some possibilities there. I’m mostly interested in it right now because, a) it’s something new (to me), and b) its not Actionscript, which I do all day at work. I’ve also been intrigued by the desktop realm lately, mostly the result of some AIR applications I’ve been working on. The image below is from a really simple particle application I’ve been using to drive experimentation.

Java particle system

So far, I’ve really enjoyed Java, and have found it relatively easy to pick-up coming from Actionscript. The biggest hurdles so far are the event system, which I’m not overly wild about. Rather than having a function handle events, Java is object based, which means you have to create classes to handle them. This isn’t a huge deal, but it does require a little more typing. Inner classes make this less of a pain, but I find it a little messy.

Another big change is working with data types. You can’t assign a variable declared as an int a floating point value and expect it to be converted for you, you need to cast. That has it’s up’s and downs, it sucks from a “I’m lazy” point of view, but makes the code very clear.

Something I love is the ommision of the keywords var and function. You don’t need to add them because the compiler is smart enough to know what you mean. It’s not a huge deal either way, but I sure don’t mind not having to type them.

Another big change to a Flash player developer is that there is no “stage” object that always exists. Your root class is a generic object, so if you want some form of enter fame loop you’ll need to do that yourself. I really like this, and find myself wishing you could work in Flash this way if you wanted to. It does make things a little more complex, but gives you a lot of control. However, Java is definitely a few steps behind Flash when it comes to display programming, and there are a number of quirks about that, but to be fair, that’s not really there goal.

So overall, I think its a great language, and I don’t think I’ll be putting it down anytime soon.

You can contact me on Twitter.

Recent & Popular Articles

Browse All >