views:

200

answers:

2

A variety of apps out there, like Firefox, Fring, Skype run on a variety of platforms. How do they manage their code? Do they have different UI for different platforms? As in, Firefox have to use Cocoa on Mac, WinForms or equivalent on Windows, QT equivalent on Linux. How is it possible for the same source code to show diff UI just by compiling for a diff target?

They ensure that a bug fix in one version (like a security issue) is fixed in all releases, this means that code is not duplicated anywhere. So How is the underlying architecture designed?

+2  A: 

In my experience what has helped me with cross-platform problems are:

  • Library code in one language that is portable across whatever platforms you need to develop on, in my case C/C++.
  • Continuous integration with unit tests so that you can pickup on any breaking code changes ASAP.
  • Very modular libraries that try to have as little dependencies as possible.
  • Don't be afraid to have specific platform implementations of whatever concept that you need for speed / features / whatever. There are many ways of hiding the fact that you are using platform specific code in your main body of code.
  • Use of design patterns can help to achieve the results you want. There are also with other principals like DRY and SOLID that help as well. This are more good software design than being cross-platform specific.

Some design issues you may face heavily depend on what you are trying to achieve. If UI isn't that be a deal then using a lib like QT may be the way to go. The same goes for any aspect of you application. Use of open-source or paid libraries helps in reducing the development time which can be a good thing.

Where your application is meant to shine, then you really should be coding that part yourself.

I can't speak much on UI choices as most of the platforms I deal with are so different that you have to re-design the UI layer every time. The fact that the libraries and main engine layers are portable between platforms help to make that easier.

Shane Powell
+1  A: 

The basic solution is to concentrate differences in a small part of the application. For instance, FireFox has XulRunner behind the scenes.

You can also use existing frameworks for that. If you use Qt on Linux, you wouldn't go to WinForms for Windows. You'd still use Qt, and that works on the Mac too.

As a result, things like security bugs are either in the platform-specific layer or in the generic layer. In the first case, you need to fix them only on the platform affected. In the second case, when you fix the bug, it's fixed everywhere.

MSalters