March 25, 2010

733 words 4 mins read

Starting Android Development

A long time ago (like last year) in a state far far away (Nevada), my job wasn’t terribly busy so I got permission to start learning iPhone development. I went ahead and purchased The iPhone Developers Cookbook, setup the MacBook Air and got started with learning. Of course just a few days later I got busy and have stayed busy up until recently. Once I got unbusy I started to switch gears back to iPhone development. The problem is, it is in objective-C, and fairly complicated just to get started (Editor’s note: Yes, yes it is.)(Un-Editors Note: John actually writes code for a living and even he finds Objective-C evil, see!)(Editor’s note: It’s the devil! Well, not the actual devil, maybe a minor demon). I’m sure once you get the hang of it, it isn’t too bad, but my C/C++ skills are minimal at best. On a whim I decided to checkout Android development and it’s all gone down hill from there.

Android applications are written in Java (with a side of XML) but compiled using something called Dalvik. This makes it easy for new developers as many people know Java. On the flip side, since it is not true Java, it puts limits on it that many experienced Java devs run into. As for me, I haven’t written Java in many years. Back in college I had several Java classes, I didn’t necessarily enjoy them (simply because of my general hating on all things Java), but I could write the code. It looked easy enough though, and a one of my coworkers raves about how easy it is to do most things in the language.

So into Android development I went. I downloaded and installed the Java Development Kit (JDK), Eclipse, and the Android SDK. After a little research I also went and bought myself a beta (eBook) version of Hello, Android (3rd Edition). I found the 2nd edition book at the local brick & mortar store and it seemed fairly decent, but of course with there being a newer version in the works, I had to get that instead. After just a a few days of going though the book, I was making simple applications. Most of it was copy and paste, but I got enough of it from code tinkering.

After a couple days I switched to writing my own micro application. It isn’t anything to write home about (which of course makes it blog worthy), but I wrote it from scratch without copy and paste from the book. It was… challenging… but not impossible. My issues go along these lines:

First off, I’m relearning Java as I go. Some of it comes back fairly quickly, but some bits require much googling to explain. I’ve really never enjoyed Java per se because applets are dumb and it makes for some hellishly slow desktop applications, but I can accept that in this case it works fairly decently.

My second major issue is learning to properly work in object oriented programming styles. See, I started in QBasic, moved on to Visual Basic, then Perl and eventually PHP. While PHP does support working in object oriented mode, the first 3 don’t (well, Perl might now, but I don’t believe it did when I started). I’ve ALWAYS worked in a procedural style, which I feel is just fine. I stumbled through object oriented previously and while I understand the concepts, I’ve never worked with it extensively.

Third and lastly, I’m learning how to write event driven programs. All my recent code has been written in PHP which fires on call, but doesn’t wait for user input. Again, it isn’t challenging to understand that I’ve got to invoke event listeners on buttons, then tell them what functions to call, but it is a bit odd. I keep trying to work in my A-to-B-to-C procedural style and it doesn’t quite mesh.

Well, it should be interesting. Should I actually learn how to make reasonable programs, I’ll try to get them out on the market. Of course, I’ll have to get myself an Android powered phone first for testing. Not that I really get a choice, but there are just so many cool ones out right now. The Nexus One will probably be it. Though the HTC Supersonic looks SWEET (granted I don’t have Sprint) and the Samsung Galaxy S has a shot (depends on the carrier).