Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

When starting a new software project that will be used on several platforms, how do you determine the best way to start development? Do you develop for one platform and then port to the next? Do you try to develop all platforms simultaneously?

For example, I'm going to start developing a Windows Phone app in C#. Much of my code could theoretically be reused with the .NET Framework and Silverlight. However I find that as I try to develop on all platforms simultaneously, refactoring and redesign tends to be 3 times as difficult and slow.

I could try writing my app for Windows Phone and then port to other platforms, but I have no ideas what hairballs await me there, and it seems like there would be a lot of potential for design decisions to bite me in the bum only after I start porting.

So which is better: develop the code for all platforms at once, or refactor and port to new platforms one at a time? What traps await me on either road?

share|improve this question
    
Is this a pet project or is somebody paying? –  JBRWilkinson May 28 '12 at 0:52
    
Pet project, small budget. –  Phil May 28 '12 at 4:55
    
I have two experiences. With Java I basically developed on Linux and deployed on Windows without changing any line of code. So I did not have to worry much about it. With C++ I developed on Linux / GCC and compiled on Cygwin / GCC. There I had to recompile more frequently on Cygwin to adapt incompatible code (so, I did it in parallel). However, it worked pretty well. So I would do it in parallel to avoid finding big incompatibilities when it is too late. –  Giorgio May 28 '12 at 16:48
    
For developing across windows platforms you need to look at portable libraries (which I am I trying to do for my hobby projects). –  Murph May 28 '12 at 19:32

4 Answers 4

up vote 3 down vote accepted

Overview

My experience, is to work with both approaches. I will say more like "parallel", "series" & "incrementally".

Description

For example, I'm designing an app. with 10 modules, and want to migrate to 3 platforms.

So I, start with a single platform, and 3 modules, usually the most important, like "core" or "system".

Then, I try to migrate that same app. to the second platform. Sometimes, I add some stuff, refactor types name, and switch back to the original platform those changes.

Example (Using "C#" & "Plain C" as "platforms, altought, you may think in "Linux", "iOS", Windows Compact Edition):

I have a custom XML parser in C# (.NET), for practical sources, "a platform", I want to migrate it to "Plain C", as another "platform".

I have this enumeration type in C#:

enum XMLNodeType
{
  Undefined,
  Declaration,
  Comment,
  SingleTag
  StartTag,
  FinishTag,
  EntityTag,
}

But, in "Plain C", for some reason, I need to prefix, the equivalent enumeration:

enum XMLNodeType
{
  xmlnodeUndefined,
  xmlnodeDeclaration,
  xmlnodeComment,
  xmlnodeSingleTag
  xmlnodeStartTag,
  xmlnodeFinishTag,
  xmlnodeEntityTag,
};

So, I decide, than I go back to the "C#" code, and replace it with:

enum XMLNodeType
{
  xmlnodeUndefined,
  xmlnodeDeclaration,
  xmlnodeComment,
  xmlnodeSingleTag
  xmlnodeStartTag,
  xmlnodeFinishTag,
  xmlnodeEntityTag,
}

When, I have those 3 modules in equivalent code, in 2 platforms, I add the migration to the third platform. Again, sometimes, I add things or refactor things, and apply those changes back to the previous platforms.

When I have the 3 platforms working, I start to add an additional module, to each platform.

Repeat the process, until all modules are available in the 3 platforms.

Summary

I don't try to do or migrate the whole app., neither "serial", neither "parallel". Only parts of of it. Add the "incremental" concept.

Even, that a section of code is working in a platform, is possible, that when migrating to another you'll change types names, and apply back those changes to the first destination.

share|improve this answer

My experience with this is C on Linux on x86 & Solaris on SPARC:

I develop on one platform and test on both as I work. This catches more bugs more quickly. I use only two platforms which forces me to separate platform dependent code from platform independent code. Later, once the program is finished I begin porting it to other platforms.

I've never needed to use more than two platforms, so I don't have experience with the final step. However this would be my plan.

share|improve this answer

Unless you plan on drastically switching languages, I would attempt the MVC pattern here so that most of the code resides in the model and controller which only need be developed once. After that, each platform can be a view, greatly reducing code across each platform and the cost of implementing new features and changing existing ones.

I did this with a software package I wrote to be available via a regular html5 website, an android app and a .NET desktop app. Most of my code resided on the server exposed via ASP.NET web services that each client would interact with. It greatly simplified the work I had to do on each client which consisted of presenting the data and available commands from the web services.

If you find yourself needing to change your storage mechanism from platform to platform, this is a great time to have an abstracted DAL that could feature any number of storage engines behind it.

share|improve this answer
    
+1 because its seems to me that a lot of this is about architecture i.e. you can structure your application to make the size of the problems smaller –  Murph May 28 '12 at 19:29

When I was writing code for Windows 32(x86), WinCE(arm), Linux (x86) and Linux ARM I found the only way to do it was in parallel. There were a few things that really helped:

  • a continuous integration system for all platforms
  • developer builds could be kicked for any platform from any developer box (it would rsync'd the code to the appropriate platform and execute the build)
  • isolating platform specific code and and creating a layer of macros and libraries to normalize the different apis
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.