Ted Neward is the Principal at Neward & Associates, a developer services company. He consults, mentors, writes and speaks worldwide on a variety of subjects, including Java, .NET, XML services, programming languages, and virtual machine/execution engine environments. He resides in the Pacific Northwest. Ted is a DZone MVB and is not an employee of DZone and has posted 50 posts at DZone. You can read more from them at their website. View Full User Profile

Doing it Twice… On Different Platforms

10.26.2010
| 6530 views |
  • submit to reddit

Short version: Matthew Baxter-Reynolds has written an intriguing book, Multimobile Development, about writing the same application over and over again on different mobile platforms. On the one hand, I applaud the effort, and think this is a great resource for developers who want to get started on mobile development, particularly since this book means you won’t have to choose a platform first. On the other hand, there’s a few things about the book I didn’t like, such as the fact that it misses the third platform in the room (Windows Phone 7) and that it could go out of date fairly quickly. On the other hand, there were a lot of things I did like about the book, like the use of OData and the sample app “in the cloud”. On the other hand…. wait, I ran out of hands. A while ago, in fact. Regardless, the book is worth picking up.

Long version: One of the interesting things about being me is that publishers periodically send me books to review, on the hopes that I’ll find it interesting and blog about it, and you, faithful blog readers that you are, will be so overwhelmed by my implicit endorsement that you’ll immediately drop what you’re doing and run (don’t walk!) to the nearest bookstore or Web browser and engage in that capitalist activity known as “impulsive consumption”. Now, I don’t know if that latter part of the equation actually takes shape, but I do like to get books, so….

(What publishers don’t like about me is when they send me a book and I don’t write a review about it. Usually that’s because I didn’t like it, didn’t think it covered the material well, or my cat is sitting on the laptop keyboard and I’m too lazy to move him off of it. Or I’m just too busy to blog about it. Or any of dozens of other reasons that have nothing to do with the book. Sometimes I’m just too busy eating pie and don’t want to get crumbs on the keyboard. Mmmm, pie. Wait. Where was I? Ah, right. Sorry.)

As many of you who’ve seen me present over the last couple of years know, I’ve been getting steadily deeper and deeper into the mobile space, predominantly aimed at three platforms: iOS, Android and WindowsPhone 7. I own an iPhone 3GS that I use for day-to-day stuff, an iPhone 3G (recycled hand-me-down in the family when one of my family bought an iPhone 4) that I feel free to abuse since it’s not my “business line phone”, an iPod Touch that I feel free to abuse for the same reason, an iPad WiFi that I just bought a few weeks ago that I’ll eventually feel like I can abuse, a Motorola Droid that my friends refer to as my “skank phone” (it has a live phone # associated with it), a Palm Pre that I rarely touch anymore, and a few other devices even older than that laying around. And yes, I will be buying a Windows Phone 7 when it comes out here in the US, and I probably will replace my Droid with a Droid X or Samsung Galaxy before long, and get an Android tablet/slate/whatever when they start to come out (I’m guessing around Christmas).

Yeah, OK, so it’s probably an addiction by this point. I’m fine. I can stop whenever I want. Really.

All of that is by way of establishing that I’m very interested in writing software for the mobile device market, and I’ve got a few ideas (games, utilities, whatever) that I tinker with when I have the chance, and I always have this little voice in the back of my head whispering that “It’s such a pain that I have to write different client apps for each one of the mobile devices—wouldn’t it be cool if I could reuse code across the different platforms….?”

(Honesty compels me to say that’s totally not true—the little voice part, I mean. Well, no, I mean, I do hear voices, but they don’t say anything about reusing code. I write these little knick-knacks because I want to learn about writing code for all the different platforms. But I can imagine somebody asking me that question at a conference, so I pretend. And the voices? Well, they tell me lots of things, but I only listen to some of them and then only some of the time. Usually when the body is easily disposable.)

Baxter-Reynolds’ book, then, really caught my eye—if there’s a way to do development across these different platforms in any sort of capturable way, then hell, yes, I want to have a look.

Except…. That’s not really what this book is about. Well, sort of.

Put bluntly, Multimobile Development is about writing two client apps for a “cloud”-based service, “Six Bookmarks”. (It’s an app that lets you jump to a URL from one of the six buttons exposed in the app—in other words, a fixed-number of URL bookmarks. The point is not the usefulness of the service, it’s to have a relatively useful backplane against which to develop the mobile apps, and this one is “just right” in terms of complexity for mobile app clients.) He then writes the same client app twice, once on Android and then once for iPhone, quite literally as a duplicate of one another. The chapters even line up one-for-one with one another: Chapters 4 and 8 are about “Installing the Toolset”, the first for Android and the second for iOS, Chapters 5 and 9 are both “Building the Logon Form and Consuming REST Services”, Chatpers 6 and 10 are “An ORM Layer Over SQLite”, and so on. It’s not about trying to reuse code between the two clients, but he does do a great job of demonstrating how the server is written to support both (using, not surprisingly, OData as the “wire protocol” for data between the two), thus facilitating a small amount of effective reuse by doing so.

The prose is pretty clear, although he does, from time to time, resort to the use of exclamation points, which I find as a pet peeve in technical writing; to me, it just doesn’t read well, almost like the faked enthusiasm you see from a late-night product-pitch man. (“The Sham-Wow! It’s great! You’ll love it! Somebody, please stop me from yelling like this!”) But it’s rare enough that I can blow past it, and I generally write it off as just an aesthetic difference between me and the author. Beyond that, he does a good job of laying down clear explanations, objectives, and rationale.

A couple of concerns I have about this book, both of which can be corrected in a future edition, stand out as “must be mentioned”. First, this space is clearly a moving target, something Baxter-Reynolds highlights in the very first two pages of the book itself. He chooses to use the XCode 4 Developer Preview for the iOS code, which obviously is not the latest bits by the time you get your hands on the book—he admits as much in the prose, but relies on the idea that the production/shipping version of XCode 4 won’t be that different from the beta (which may or may not be a viable assumption to make).

The other concern is a bit more far-reaching: I kinda wish the book had Windows Phone 7 in here, too.

I mean, if he’s OK with using the developer preview of XCode for the iOS parts, it would seem reasonable to do the same for the WP7 Developer Tools, which have been out in a relatively stable form for quite a few months. Granted, he (probably) wouldn’t have been able to test his software on the actual device, since they appear to be rarer than software architects who still write code, but I don’t know that this would’ve changed his point whatsoever, either. Still, if he’s working on a second edition with WP7 as an additional client platform and another five or so chapters for comparison, it’d be a near-flawless keeper, at least for the next two or three years.

(Granted, he does do the .NET world a little justice by including a final chapter on MonoTouch, but that feels a little “thrown in” at the end, almost as if he felt the need to assuage the WP7 stuff by reminding the .NET developers: “Don’t worry, guys, someday, real soon now, you’ll be able to write mobile apps, too! And then clients will love you! And women will flock to you at cocktail parties! Somebody, please stop me from yelling like this!”.)

Overall, it’s a good book, and I like the fact that somebody’s taking on the obvious topic of “Multi-Mobile” development without falling into the “one source base, multiple platforms” trap. (I groan at the thought of how many developers are now going to go off and try to write cross-platform mobile frameworks, by the way. I don’t think it’ll be pretty.) It’s not a complete reference to all things iOS or Android—you probably want a good reference to go with each platform you write to—but as a “getting started with mobile development”, this is actually a great resource to have for both of the major platforms.

References
Published at DZone with permission of Ted Neward, author and DZone MVB. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)