Java ?!?

Now I’ve been playing around with Java for a few weeks. Last time I looked at Java, it was version 1.1 (I still have a book from that time). It has changed since then – some features notably templates have been added. Back then I tried to use it for interface purposes: having one solution for Windows and Unix. But there was a lot of overhead,  runtime environments and I didn’t like Swing very much. So for projects we preferred QT at that time. There were some other experiments by colleagues to use Java, but if you have either huge amounts of data and/or demanding algorithms – like in the area of optimization, hardware verification, Java (with or without JIT) didn’t quite scale up to the task.

I can understand the Android approach: you are basically hardware independent, most of the compution needed is interface specific (graphical) and can be delegated to builtins. Other demanding algorithms can be delegated to the cloud, whereas controlling these graphic actions can be done in Java. Should there be essential bottlenecks, one could add new classes with builtins in the next firmware edition.

With my two toy Apps, I didn’t think I would have any performance issues, as scaling bitmaps and decoding codecs is done by the firmware and everything else is trivial. Nevertheless I looked at the Performance section of the Android Dev Guide. It wasn’t really a surprise to read that in contrast to C++ you do have to compromise between a clean textbook software design and a performant program. Worst thing probably is creating temporary structures (new), which can be directly equated to long GC runs, and using access functions (get/set) instead of direct field access (JIT currently even increases the difference!).

The lesson? Think about, which projects might be reasonable for an Android phone. If you have a lot of computation to do, delegate it to the cloud!

For my projects – there are different problems… fix all the FCs, that result from casual coding.

Posted in Android | Leave a comment

Android – First Steps

Bought a new phone in April – it’s an Android phone. After some playing around bought a book about Android, loaded down the SDK, read the online documentation. In order to start

  • you don’t need to buy a Mac (as for the iPhone)
  • you don’t need to use archaic GNOME libraries (or modified QT desktop as for Maemo)
  • you can use Java – and the SDK seems to be structured and sensible (actor/message oriented)

So I started to try it out for a simple project – Androku – a remote control for my Roku Soundbridge – and after about a week reading the book, the online documentation and searching the WEB for code snippets, the application, or let’s say the ALPHA seems to work.

I know, there are other applications in the market, but I shall publish it as freeware. Currently the GUI is a bit rough, and behaviour on other platforms is unknown. But on my Desire it seems to behave pretty well:

  • it doesn’t drain any battery, when the display is off
  • it watches the wifi state: disconnects, when wifi is off, reconnects, when both wifi and display are on
  • it even allows roation

So let’s see how the Android market works!

Posted in Androku | 3 Comments