4

I am wanting to write an application for 3 platforms (iPhone, Android, and WPF). I am looking at using monotouch and monodriod to achieve this so I can keep all development in .net

Now I want to be able to reuse as much code as possible so I need a little advise on how I should do this as I don't really have a clue where to start.

How should I separate the project out to allow the most amount of code reuse between the 3 different platforms?

Any suggestions would be appreciated.

Zoot
  • 2,217
  • 4
  • 29
  • 47
Diver Dan
  • 9,953
  • 22
  • 95
  • 166

2 Answers2

4

I can see code divisions along the lines of Model-View-Controller (MVC) working pretty well here. You can maybe have your Model & Controllers live in a single common project and just have separate projects for the "View" of each different platforms.

This way, you can keep your data model and logic separate from how its displayed to the user. Moreover, you'll be able to re-use your Model/Controller project easily amongst various mobile apps, web apps and desktop apps

Danish
  • 3,708
  • 5
  • 29
  • 48
  • Thanks Danish. That makes sense. So in my common Model-Controller project I handle all of my database calls to the my main server to do the standard crud operations. If I want to store local data using the various local databases I guess I would do that in the local platforms project. – Diver Dan Mar 03 '11 at 21:06
1

I realize this wasn't your question but depending on your requirements you may want to take a look at PhoneGap. Not really a .Net solution but probably worth a look if cross platform is an important issue for you.

EDIT:

You probably also want to take a look at this blog posting (which was posted since you asked your question). Discusses the issues with attempting to support iOS and Android and WP7 with the same code base.

Onorio Catenacci
  • 14,928
  • 14
  • 81
  • 132