Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Anyone have experience with architecture for cross platform WP7 Android iOS mobile development (monotouch, monodroid, C#)

This question is specifically related to a recommended architecture and people's previous experiences for cross-platform WP7, iOS, Android apps developed using C#, Monotouch and Monodroid respectively. I have researched previous questions here, here and here. They provide good answers but not quite what I'm looking for. I have also found this excellent question which does go into the cost benefit so there is some overlap.

I have a requirement to develop a cross-platform iPhone/iPad, WP7 and android app for a health & fitness company, which will integrate with their website. The app requires a small amount of local data storage for offline mode and synchronisation with the website when a network is available. I am a Windows (C#/C++) developer through and through and don't really want to go down the route of three Objective C, Java and C# apps, although I will if I have to. I will also be operating as tech lead and farming out some work to a team on this project.

I would like to know if anyone here has experience with cross-platform development using Monotouch, Monodroid and WP7 and to share their experience on application architecture to re-use as much code as possible. The architecture I am considering is as follows:

Proposed architecture for Wp7, Monotouch, Monodroid app

My question is as follows:

  • Has anyone here tried something like this?
  • Are these frameworks (Monotouch, monodroid) worth their salt for this sort of work?
  • Can I setup the entire project in Visual Studio 2010 with separate projects (dlls/exe) for the Monotouch, Monodroid and Wp7 target (but shared code using 'Add as Link')?
  • What sort of code-reuse can I realistically expect with this (or a similar) architecture? i.e. what strategies/patterns can I use to re-use local data access, webservices, and business logic?
like image 965
Dr. Andrew Burnett-Thompson Avatar asked Jan 06 '12 09:01

Dr. Andrew Burnett-Thompson


People also ask

What is iOS mobile application development cross-platform?

In cross-platform apps, some or even all of the source code can be shared. This means that developers can create and deploy mobile assets that work on both Android and iOS without having to recode them for each individual platform.

What is cross-platform development?

Cross-platform mobile development is the creation of software applications that are compatible with multiple mobile operating systems. Originally, the complexity of developing mobile apps was compounded by the difficulty of building out a backend that worked across multiple platforms.

Which programming language is cross-platform?

To code cross-platform software, developers use intermediate programming languages — HTML, JavaScript and CSS — not native to devices and OSs.

What is cross-platform Framework?

Cross-platform app frameworks are the tools used by the developers to create apps for multiple frameworks. Unlike native, cross-platform frameworks allow developers to develop an app with one-time coding and run it on all platforms such as Android, iOS, Windows, with a few minor changes in the development of course.


2 Answers

You might want to look into the MonoCross project which is designed to help you reuse C# code with multiple presentation layers:

http://code.google.com/p/monocross/

The authors of MonoCross (ITR Mobility) have created multiple mobile cross platform solutions for a variety of customers and have written two books on the subject one is "iPad in the Enterprise" (http://amzn.to/zAhQK6) and the upcoming "Cross-Platform Mobile Development with C#" (http://amzn.to/wM6RsF).

In the meantime, you can watch Scott Olson's presentation that he did at Monospace 2011 that describes how to use MonoCross to target multiple mobile and desktop platforms at once reusing the business logic:

http://www.infoq.com/presentations/The-Rise-of-Mono-in-the-Enterprise

They enforce a strict MVC split in their code:

MonoCross MVC Pattern
(source: tirania.org)

The biggest benefit of designing an application with this model is that you can run the same application with native user interfaces on each platform. You get native iOS, Android, Windows UI and they even have an ASP.NET front-end that allows you to publish Web versions of the same business logic.

This technology was used successfully by the Medtronic sample app that is showcased by Apple in their iPad business:

http://www.apple.com/ipad/business/profiles/medtronic/

I suggest you also check out Scott's blog where he posts regularly about his experiences with cross-platform architecture.

like image 199
miguel.de.icaza Avatar answered Sep 18 '22 08:09

miguel.de.icaza


Based on your comments your requirements are for a cross-mobile platform that will integrate with their existing services, but also work offline. You are specifically interested in C# via Mono, however you have indicated that you are not discounting other approaches.

I feel that HTML / PhoneGap / JavaScript is a route that you should explore in some detail. The WP7 version of this framework has just been released, and I have had experience of releasing an application to the marketplace using this approach.

PhoneGap wraps your HTML / JavaScript code, in the case of WP7 this is loaded into local storage. This enables the application to work entirely offline. This is true for all versions (iOS, Android etc...)

Probably the biggest issue with PhoneGap / HTML5 is the same issue we have when developing complex web based applications for the browser. The tooling for JavaScript is not great and browser differences are a constant issue. However, it is a tried and tested solution.

Finally, it is possible to create an application UI that is entirely different for each platform. By using the MVVM pattern I have managed to share all my JavaScript business logic between WP7 and iOS applications whilst having a totally different UI:

enter image description here

Compare this to the WP7 screens:

enter image description here

NOTE: I plan to have the iOS version of Property Finder in the AppStore shortly, I just need to work out how to use PhoneGap Build!

like image 35
ColinE Avatar answered Sep 18 '22 08:09

ColinE