4 ms·
With all of the platforms available now to C# developers (iPhone, Android, Window Phone 7, Windows, Linux, Mac) it makes sense to build applications in a way th
by migueldeicaza 16y ago
With all of the platforms available now to C# developers (iPhone, Android, Window Phone 7, Windows, Linux, Mac) it makes sense to build applications in a way that will allow you to create native experiences, but also share your code across multiple platforms.
Our recommendation to developers is that they split their applications across the User Experience/Business Logic fault line. Developers then can replace the user experience with native user interfaces for each platform.
This is a bit abstract, so we tend to tell people to build a lot of UI-less reusable libraries and for libraries that have UIs, to split their Model-View-Controller libraries in a way that the Model and its support infrastructure are reusable and the View and the Controller are UI-specific.
This extends a little bit further. You also might end up with an "OS" layer that performs certain tasks in a different way depending on the operating system that you will be running.
For instance, while running on an iPhone, you have access to the gyroscope, something that you wont find on say a Linux desktop. Or on Linux, you will have access to /proc, which you wont have access to on Windows Mobile 7.
A nice example was Paint.NET. When that application was built, the operating-system specific features were all placed on a library called SystemLayer.dll. The UI was all Windows.Forms, but porting the program turned out to be limited to replacing the SystemLayer.dll with one that spoke Posix as opposed to speaking Win32.
- anonymous245 16y agoThank you for giving some sane advice, instead of peddling the magical "single source/multiplatform" promise.
- Tamerlin 16y agoI agree, that's good advice -- it's what Sun should have done with Java instead of pushing the least common denominator UI libraries, which lead to a host of lousy UI's that worked equally poorly on every supported platform. :)