Really Cross-platform?

Hello there!

In my company we are trying to change to a framework that we can use to develop a true cross-platform application. The problem is that we want to code one time and deploy in all this systems:

  • Android – IOs – Windows – Mac – Linux (maybe not this)

Would Xamarin allow us to do this? Could we really share a lot of code with between all this platforms? If yes… what are the parts of code we could share between the platforms?

Thanks for your answers and your time.

Posts

  • CheesebaronCheesebaron DKInsider, University mod

    You probably need to think about what "true cross-platform" means for you.

    However, the short answer is no. You won't be able to build one app and deploy everywhere like other framworks like Phonegap, Rhodes etc. do. Mainly because you are actually creating native applications, not that HTML5 crap others do. With Xamarin you get real native look and feel, because you are actually using native views!

    There are tools that run atop of Xamarin, which help minimizing the amount of code you need to rewrite for each platform, but it is nowhere near 100% code reuse, but rather like around 90%, when you do stuff the right way.

    So yes, you will be able to share most of your models between the platforms, and if you are using certain frameworks this amount of code will be higher, because they provide abstractions for stuff like GPS, Accelerometer, writing e-mails, starting a web browser etc.

  • LuchaLucha ESMember

    Thanks for the answer.
    But... what are those frameworks you are talking about?

  • CheesebaronCheesebaron DKInsider, University mod

    I am really biased and really like MvvmCross, that was kind of why I did not make a big promotion speech just about it :D

    But really, MvvmCross is really great, especially if you are making apps of a bit larger size. It takes a bit to get used to how it works, so it has a slight learning curve. However, it has matured a lot since I started to work with it. Along with the recent PCL support everything is super awesome.

    Also with all the plugins, which appear for MvvmCross a lot of stuff is being abstracted for you. IoC and Mvvm is the way to go, if you ask me.

  • NeilWhitlowNeilWhitlow USUniversity ✭✭

    You can take a look at propertycross to get an idea of the other frameworks he's mentioning.

    Be aware that the Xamarin implementation there is not the best because it's a bit dated, so the code sharing reported on that comparison site for Xamarin is less than it could be.

    Now that PCLs are sorted out, using PCL/MvvmCross (MVVM instead of MVP), you can get much better code sharing with Xamarin.

    One of Xamarin's strengths imho, is the part you can't share. It is not lowest common denominator GUI like with the HTML5 based frameworks. What you don't get to share in Xamarin on the GUIs is the part that you really want to be native to each platform anyway.

  • LuchaLucha ESMember

    Great. This is getting a lot clearer.
    One more question: PCL stands for...?

  • GuillermoGutierrezGuillermoGutierrez ESMember ✭✭✭

    PCL stands for Portable Class Library. Using MVVM you will share the Models and the ViewModels. This article explains it pretty well.

  • LuchaLucha ESMember

    I see... This PCL only works for developing mobile apps? My goal is to reuse code between mobile and desktop apps.

  • GuillermoGutierrezGuillermoGutierrez ESMember ✭✭✭

    PCL also works for Windows Store Apps and Mono for Mac. It mostly depends on the PCL profile that you choose. The most commonly used is Profile104, that officially supports .NET Framework 4.5, Silverlight 4, Windows Phone 7.5, Windows Store apps (Windows 8), and works also on Xamarin.iOS, Xamarin.Droid and (haven't tested myself) Xamarin.Mac.

  • LuchaLucha ESMember

    What about windows <= 7 ?

  • SKallSKall USMember ✭✭✭✭

    Older Windows versions are supported (.NET runtime).

    You can run a WinForms application on Linux (and Mac) but GTK# would be better. I don't think Qt bindings for C# are up-to-date.

  • RobertSalitaRobertSalita USMember ✭✭

    While I really like Xamarin's concept and applaud MvvmCross, my customers really want solutions that will be there 10 and even 20 years from now. I'm particularly looking at QT project, and Titanium. While native is the choice du jour, the long view is important in some situations.

  • PkL728PkL728 USMember

    As someone who has used Titanium.... Just don't. Titanium was built for iOS and then they just threw Android in there. From our experience in writing large applications, the performance is just bad. Memory leaks are prevalent and its very hard to figure out when something has gone wrong in the native code you are compiling to.

    Titanium also seems to take longer to handle new releases of iOS and Android when they happen. They are trying to focus on too many things (i.e. BlackBerry and Tizen) and end up doing none of it very well.

    Add to that... I personally dislike JavaScript and much prefer C#, but again that's a preference.

    If you compare the quality of the two, I would easily say that Xamarin will be around for much longer than Titanium will be.

  • RKDF250RKDF250 USMember

    The Xamarin suite in my opinion is the best solution out there. I did not use HTML5 because I needed access to the unique abilities of the different devices. If you are going to truly maximize a user's experience then Native Code is the way to go. I have been able to reuse about 85% of the code on each platform. The User interface is the only thing that needs to be customized. Of course with android devices that can be much more complicated. I really like the IOS platform and when you couple it with AIRWATCH MDM deployment and maintenance is really simple.

  • LuchaLucha ESMember

    So is it viable to share code between mobile and desktop platforms?

  • SKallSKall USMember ✭✭✭✭

    Qt is a nice framework but you will be losing WP8 compatibility and I doubt support for iOS is as extensive as it is with Xamarin.

  • RobertSalitaRobertSalita USMember ✭✭

    Thanks for the feedback. I'll factor in all your opinions.

  • SKallSKall USMember ✭✭✭✭

    @Lucha, absolutely, sharing code with desktop is not a problem. You might get better reuse by also diving desktop application view into smaller control windows but there is nothing preventing you from developing desktop and mobile applications from the same code base. Follow MVVM design pattern and abstract where needed and you'll be fine.

  • MikhailFayerMikhailFayer DEMember, Beta

    Sharing code with desktop is easy as long as you write the code mobile-first, and not the other way around. Mobile is much more restrictive than desktop so you can see it as a subset of what's possible on the desktop. As a bonus, if you write mobile-first you'll get an unusually performant and robust desktop app from having overcome all the architectural barriers of mobile dev.

    BTW, MvvmCross supports WPF, I'm not quite sure about WinForms/QT/etc.

  • Qt mobile edition looks promising:
    http://thenextweb.com/dd/2013/12/11/digia-releases-qt-5-2-android-ios-support-previews-windows-rt-launches-qt-mobile-edition/

    Blackberry, iOs, Android, and WP support

    Maybe Xamarin must make official bindings and project template.

    Does anyone want to join to make it work ?

  • SKallSKall USMember ✭✭✭✭

    I have played around with it but where it is currently the pricing is way too high (for mobile development). Ah, Qt and Symbian development, brings back memories from the old Nokia days... I think I will ELeave it alone for now... :D

Sign In or Register to comment.