Learning Android Development: an iOS Developer’s Perspective
“Give yourself to the Dark Side!”
I recently attended one of Big Nerd Ranch’s Android bootcamps at Banning Mills. This caused a lot of consternation on Twitter, as I’m considered a die-hard Objective C and Cocoa fan—in fact, I teach iOS bootcamps for Big Nerd Ranch.
Attending the Android class also cost me more than a few unfollows. This is the whole story of my “downfall.”
Once upon a time at Facebook…
About a year ago, I was teaching a Beginning iOS bootcamp at Facebook, in Menlo Park. After classes, I would meet with a friend of mine who works nearby in Palo Alto. Eduardo was also an iOS developer, but he had recently turned to “The Dark Side” and was doing mostly Android development at that time. He was also attending Google I/O during that week, so I was forced to endure hours of drivel and indoctrination about all the “new and cool stuff” Google was releasing. Slightly annoying, but certainly not enough to shake the beliefs of the someone like me, the “truly faithful.”
We usually had dinner at the Outback Steakhouse right in front of Apple’s HQ in Cupertino. To add insult to injury, he had the obnoxious habit of entering the restaurant, which is crowded with Apple employees, wearing…you guessed it: Google Glass! I was in constant fear that security would kick us out at any time.
A Borg / Dork hybrid
Let’s admit it: Google Glasses do make you look like a dorky Borg… but an extremely nerdy dorky Borg. I resisted for days, but finally gave in and asked to try them (not that I was really interested, of course).
After looking around to make sure there was no security personnel from Apple in the restaurant, I put them on my face and…that was it. Just like Anakin, my downfall was inevitable.
The Glass I tried on was obviously a prototype, but a prototype with a tremendous potential and the only truly new device I’ve seen in years. You can’t get nerdier than that. And pure, raw nerdiness has an irresistible sex appeal for some people, such as yours truly.
On my way back home to Madrid, the idea of developing for Google Glass started to creep into my mind, like an insidious worm. I had tried a Nexus 1 several years ago, and it wasn’t for me: the phone had a small gap between the screen and the plastic (yes, it was unapologetically plastic) that would always catch a hair from my head when I answered the phone and inevitably plucked it. A phone that would make me go bald wasn’t worth my time, but those glasses? Well…
Back to Historic Banning Mills
My current schedule is pretty tight and it seems almost impossible to settle down and devote a few weeks to learn something new. No matter how hard you try, distractions just keep creeping out of the woodwork and reaching you.
Given my crazy daily schedule, there was no other solution but Dr. Hillegass’ prescription: one week of total Android immersion in a distraction-free oasis amongst the woods in rural Georgia.
Even though I was learning 10 to 12 hours a day and badly jetlagged, the bootcamp felt like a getaway: no interruptions, no phone calls, no emails. In a Big Nerd Ranch bootcamp, you can focus on just one thing: learning nerdy stuff.
I estimate that the week I spent at Banning Mills with my fellow wannabe Android nerds and Kristin Marsicano, our über-nerdy instructor, saved me from spending three months learning on my own. Plus, I got a break from my day-to-day life, something that was sorely needed.
Android from an iOS perspective
Learning Android was very surprising for me, as I was expecting a far more familiar environment. After all, both operating systems are Unix-based, and the languages are C-based. Not so, little grasshopper.
Android has a very peculiar and interesting feature that sets it apart from almost any other OS I’ve seen. On iOS, and almost everywhere, the application is the basic unit of interaction in the system. That’s not true of Android. The basic unit is the Activity, which is something like a UIViewController on iOS.
Activities within different apps can communicate among themselves and can be different entry points to your app. So, when completing a task, such as answering an email and adding a photo, you could be using several apps (one for email and the Photo Activity of some other App). Well-designed Android apps blend into the system and become a loosely coupled set of Activities. How cool is that?
It’s also a little bit inconvenient, as sending information from one Activity to another is far more cumbersome than communicating UIViewControllers on iOS. The communication itself is reified in a class called Intent. The whole thing reminded me of communicating distributed objects with CORBA, back when Windows ruled the Earth.
The way the different Activities or Fragments (a concept similar to Activities) are organized on screen is also different. For starters, there’s no UINavigationController: the whole system is already a Stack of Activities.
However, the most surprising fact was that Android development seemed more verbose than iOS programming. And when an Objective-C developer says that something is verbose, you better take it seriously! The reason is that the Android SDK doesn’t abstract away common cases with default behavior. For example, whenever you create a UIViewController in iOS, you don’t have to specify the name of the xib file for it, unless you’re doing something uncommon. Otherwise, the UIViewController will find the xib file by searching for one with the same name as the class. In Android, you have to manually specify the layout file name, over and over.
This shows that you can bring ideas from one environment to the other. iOS developers can also learn a trick or two from the way layouts work in Android and improve the insufficiently abstract classes that Cocoa provides for AutoLayout.
The things that I missed the most as an iOS developer were a language that doesn’t suck (sorry, couldn’t help myself), blocks and Core Data.
Harness both sides of the Force you must
Learning Android made me a better iOS developer, as it gave a fresh new look into mobile dev. Knowing both makes me a much better mobile developer.
If you’re a hobbyist, you can afford to ignore one of the main platforms, but as a professional, it just doesn’t make sense from a career and business perspective. Being capable of developing on both platforms is a must, even if you’re not particularly fond of one of them.
Therefore, if you’re an iOS developer, keep making jokes about Android, but you should learn it. And if you are an Android developer, come join us on the other side of the fence: we won’t make fun of your ridiculously large phablet. Promise.