2010-05-29 14:06:35
My experiences with the Dalvik Java Virtual Machine on Android so far
I present the conclusion first. This is an affair of love and hate.
If you expect something like the nowadays JME than you will be disappointed.
Dalvik is strange in many ways, sometimes for the good, sometimes for the evil side.
One of the greatest problems is Dalvik is a young system. The first Android mobile touched
2 years ago the market, the programming environment is round about one year older.
Guess what, so is the documentation. Google is making a good job on improving the documentation.
Still a tons of answers are missing, still people do not have enough stable experience with the system.
New features are appearing, old ones do work suddenly, but only on new devices.
There is a big gap between more of the half of all devices (66%) and the new once (33%).
For good sake more and more new devices reach the market.
But there is a lag of support for new versions on old mobiles. HTC and others are not doing their job.
It would be much better for Google to do this support, so everyone can update their mobile. And I'm sure users will do so.
The Activity model that is used for visualization of the application is nice.
Most time you configure in a simple to learn xml syntax what component is seen where.
You should not have any trouble to make you application suitable on any possible device resolution.
There are some tricks and still some strange because unexpected behavior. As I said there is a lag on the documentation. But over all it is a really nice full filling of the KISS paradigm.
The real problem with the activity model is, it avoids to port Java Apps to Android the easy way.
Instead of Graphics it uses the Canvas, Paint is not Paint it is a BrushWithPaint object.
Dalvik is not a subset of the Java JSE language. There is a gap of meaning. Although both share the basic classes, like JME and JSE do, Dalvik introduces different conventions of naming. So is the EventModel. It looks pretty like pre-Java-1.0. It is messy. OnDraw, OnClick, OnResult, but you'll never know when, why and where it is granted and where not. Educated guesses do not lead to the expected results in 66 or even more Percents. It is not clear, if it is an event or not.
The is no concept of update and repaint, no real control over the UI-Thread, except the SurfaceView. A view (component) that allows you to create a Thread to call the onDraw method.
There are more stupid things like ActivityGroups can't start Activities with a result as feedback. The LocalActivityManager does not have such a method.
By the way here is a tip. Always make sure that you organize your applications horizontal or vertical. I ain't talking about the layout! Activities can start other Activities. I call this vertical. Be sure that a child activity has closed. A child activity should never start an activity of the same level or the parent level. This would be an diagonal reference an keep the parent alive. This is a mess.
You may use instead an ActivivtyGroup as a controller. So every child activity is on the same level. I call this horizontal. This also avoids the mess with still living activities. Your application can close immediately.
Resume: Androids dalvik VM is nice, but young. It is open and easy to learn. Everyone can have access to it.
The tools for development are good. The system has a fast iteration of development. Every three to 6 months there is an new Api Level with more improvements for the good.
You should not compare the Android system with the IPhone. That one is already ten years old - some components are even older. It is close and very restrictive. My advice to Google: be a little more restrictive, so every user has a chance to access the newest API Level. Many bugs on older systems would disappear.
As I said it is an ongoing story of love and hate.