Back to Java (for Android)

Some months ago I began tinkering with programming for PSP. I installed the toolchain and all that, but kind of abandoned it because although the ps2dev guys created a really nice environment to develop in, it still felt bad and precarious in a certain manner: whatever you did was in a way illegal. You had to jailbreak your PSP for installing custom software and so had to do the potential users of your application. And it didn't feel right to be programming for a platform whose creator (Sony) doesn't want you to program for -- unless you pay them a license, I guess. On the other hand, developing for iPhone is definitively a no-go area for me, as you might already have deducted from my previous posts on this subject.

Then, Android happened... and yesterday, somehow I thought: And why not? I wasn't aware that it was that easy to get started, and I am very pleased to have been proved otherwise: I downloaded the SDK and began following the guides and more or less had a grasp of how to build my first app in just few hours. Compared with building something for PSP, it is actually a bless. I do not know how does it compare with programming for iPhone, but from my experience with Cocoa, Objective C and XCode, I am sure it is much better. If only morally speaking and because one does not need to use the cumbersome [ brackets : everywhere syntax [here : with more [brackets : ha! ] ] or the infamous and opaque Apple developer docs.

It's been a very very long time since I last did any Java programming --OK, actually it is not that long, only five years, but that, in Internet time, is definitely a lot of time--, and hence my ability to combine layers and layers of code to form what I used to call the archetypal Java onion is a little bit rusty.

So I am all the time looking for information googling for this and that, since I don't remember well certain things, other have changed, some features are not implemented or are slightly different in the Android platform, and finally, in other cases, my mind is intoxicated with other languages and I tend to think that if something is available in language X there will probably be something like that in Java.

And there I was, looking for some info regarding File separators, when I found this guy suggesting the use of File.separator. Of course!, I thought that's the least one should do. In fact, I was looking for an equivalent of Python's os.path.join, which I happen to find very convenient, so this wasn't exactly what I expected to find. Anyway, I kept reading the comments and suddenly got hit where it truly hurts:

What about properties file?

says that comment. Ouch, that really HURT.

This was one of the main reasons why I disliked Java programming. The tons of property files scattered all around the project, for configuring all sorts of stuff which could be deducted sometimes or that wasn't actually needed in fact, but was there, due to lazy habits, or just out of ignorance. And XML databases, and a myriad more horrors created by unexperienced bad Java consultants. Not that I was the Best Java Programmer EVER, but I certainly noticed the code smells, which is undoubtedly the first step towards better coding.

Fortunately, things seem to have changed a lot since then. For good: my development computer is amazingly fast (back then, I was assigned a rheumatic Pentium III at 550MHz with a ridiculous 64M of memory and 6 Gb disk - of which only 0.5 were actually free: you had to use headphones to prevent your ears from being mercilessly hammered with page-swapping noises). And in the software front, the Android SDK is very nice and well thought (or at least it seems so, at first sight). The emulator -- I love it! That's where the whole concept of Java demonstrates its power, since being a virtual machine, it can be executed everywhere, whether it is the actual phone or the emulator.

I also like the idea that you can get really dirty --programmatically speaking, that is-- and optimize certain parts of the code with C or assembly. Of course, then you can instantly forget about portability aspirations (since it will get compiled for an specific processor, i.e. ARM), but if required, could be done.

Being day number 1 of Android programming, I still feel a tad lost, and some things do not make much sense yet (for example: the easiness with which the applications get terminated when an error is encountered, although it is understandable in a limited resources environment such as a phone) but I am finding my way around.

Expect to find some Android related posts here from now on :-)