Mobile Zone is brought to you in partnership with:

John Sonmez is a Pluralsight author of over 25 courses spanning a wide range of topics from mobile development to IoC containers. He is a frequent guest on podcasts such as DotNetRocks and Hanselminutes. John has created applications for iOS, Android and Windows Phone 7 using native tools, HTML5, and just about every cross platform solution available today. He has a passion for Agile development and is engaged in a personal crusade to make the complex simple. John is a DZone MVB and is not an employee of DZone and has posted 86 posts at DZone. You can read more from them at their website. View Full User Profile

Cross Platform Mobile Development (iOS, Android, WP8)

04.20.2014
| 6052 views |
  • submit to reddit

What is your strategy for cross platform mobile development? It is a hard question to answer, because there are so many choices out there. In this video, I talk about what I think about cross platform mobile development, define your options and give you my recommendation. So, if you are thinking about developing for iOS, Android, Windows Phone or Windows 8, check it out and let me know what you think.

Full transcript:

John:  Hey, everyone.  John Sonmez from simpleprogrammer.com and today, I do not have an inspirational video for you.  That’s right.  I’m going to be talking about a technical topic, one that, I think, is really important that’s pretty relevant on a lot of people’s minds today.  That’s right.  I’m going to be talking cross platform mobile development, and I’m going to share with you some of my thoughts around this area and some of the techniques you can use to be successful if you’re trying to create a mobile application and you want it to be cross platform.

Cross platform mobile development.  What does this mean?  Basically, hey, let’s say that you’re trying to build an app, right?  What do you do?  Your first step is you got to say, “Well, what am I going to build this for?  Am I going to build this for iOS?  What about Android or am I going to touch Windows phone even if it has a small market share?  What am I going to build this for?  Am I still going to try and do Blackberry?”  I hope not.

Basically for the most part, most developers, most companies considering this choice are basically choosing between, “Should I do Android or iOS, or I should do this Native and should I create a web version of this application, or even try to go to the Windows 8 platform for this?”  How do you decide?  Well, let’s talk about the different options and I’ll give you an idea of what I think is the best way to go today.

First of all, you have Native.  Now, if you go Native here’s the thing.  For iOS, you’re going to be developing an Objective C.  You’re going to be using the Cocoa frameworks and you’re going to be developing on a Mac.  For Android, you’re going to be doing Java and you can develop Mac or Windows, but you’re probably going to be using an emulator.  Your code bases are not going to be shared.  This is something really important to consider.

Now when you go Native, you’ll of course have all of the Native UI elements.  You’re able to make an application that feels like an application for that platform.  That’s why a lot of times people choose to go Native.  You can hit the 2 biggest markets if you just did iOS and Android.  If you’re doing a paid type of application, if you just hit iOS, that’s an option that a lot of people start with.  It’s just hitting iOS.  That sometimes makes sense.

That’s option 1.  Option 2 is to do something in between Native and let’s say full HTML or full cross platform.  One option in there and this is the one that I’d probably recommend the highest is the Xamarin tools.  Xamarin tools let you write an Android and an iOS application in C#.  You can use the portable class libraries in C# to make a lot of your code portable so you could reuse some of that code.  Now, the difference here between Native and Xamarin is small because Xamarin just sits on top of these Native APIs and it basically just gives you a C# way of writing this code.

There’s a little bit more going on under the cover, but you’re still using the Native controls.  It’s still very much Native at the end even though you’re using this other layer and this other tooling to do this.  Then you can go up from there and there’re a couple of other things that are in between here.  You have things like Titanium.  You’ve got things like PhoneGap where you could actually build a hybrid application.  That’s going more towards this HTML5.  We can traverse all the way down the path to HTML5.

You can build an HTML5 application and you could basically host it on your website, and you can make it work on the mobile platforms.  Maybe you could use something like Kendo UI from Telerik or Sencha Touch.  Then what you would have is basically an HTML5 application that’s responsive and works on the different mobile platforms.  If you wanted to make an installer and application, you could wrap this with something like PhoneGap and then it would basically just wrap that Native or that HTML5 application.

Those are your choices, and here’s the pros and cons when you’re thinking about this choice.  If you go full Native, you’re probably going to get the closest to that platform’s experience, but you’re going to need experience and tools, and developers that can write in those platforms.  Writing Objective C, if you’ve never done it before, is not that easy.  There’s a big learning curve there.  Even on the Java side and working in Android, there’s a learning curve there as well.  If you do want to touch Windows phone, then that’s a whole another platform or if you want to go Windows 8, that’s a whole another platform.

If you go the full HTML route, right now I don’t think we’re there yet.  I think we’re going to be there.  I think things like Firefox OS are going to drive us forward, and as phones and tablets become more powerful that we’ll eventually want to go full HTML5 on the mobile platforms.  But we’re not quite there.  Right now, the experience is still a little bit crippled.  It’s still a little bit hard to get things to work on each of the devices that look right, and there’s a little bit of lag.  Things are not as fast.  They’re not quite as performing as when you go Native.

Now if we take a hybrid approach and this is the one that I recommend right now.  For most developers, especially the ones that are watching this video because I know a lot of you are probably C# and .NET guys, you probably are going to be doing best by doing Xamarin.  Because the thing about Xamarin and the reason why I like it so much is that you can write one language, C# and then you can basically use portable class libraries to share a lot of your code.  If you use something like MvvmCross, MvvmCross is basically another library that works with Xamarin, it can allow you to use up to 90 or more percent of your code, where the only thing that’s different between the different platforms is just the views.

I definitely would lean towards the Xamarin route.  You still have to learn the Native APIs so you’re still going to have to learn iOS development and Android development, and Windows phone or Windows 8 development, but you’re going to be able to share a lot of the code.  You’re going to be able to basically write in one programming language instead of trying to spread it out and trying to learn all these different programming languages and not be able to share any code.  Then you’re not going to have the problems that you do with HTML5.

That’s my advice for now.  I think in the future it’s going to change.  Like I said, I think we’re going to go more into HTML5.  I think that’s going to become more of a viable option.  Right now, I would stick with either going Native or using something like Xamarin, and possibly using something like Titanium where you are writing JavaScript code that ends up getting compiled down to Native.  Of the two, of Titanium and Xamarin, right now my bet is on the Xamarin side.  There are a lot of great things coming from Xamarin.

I’m not plugging.  I’m not affiliated with Xamarin in any way.  I am an insider on their program, but I don’t get paid to promote them.  I just happen to like the tools.  If you like this video, if you thought this was useful don’t forget to subscribe to my channel.  Check out my blog at simpleprogrammer.com.  I also have some videos on Pluralsight, not just on Xamarin but I have some videos on iOS, on Android development natively.  I have Xamarin videos on how to develop with Xamarin and then I have videos on Titanium, and even Firefox OS.  A whole bunch of different mobile things in cross platform development there, so don’t forget to check that out as well.

I hope this was useful to you.  Take care, have a nice day and I will talk to you again next week.

 

Published at DZone with permission of John Sonmez, author and DZone MVB.

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