Is Xamarin.Forms the panacea we seek?
This is a serious post, not just me thinking aloud.
We all love and use Xamarin (irrespective of it's on a Windows box or OS X), some of us make a living from it, write books on it and even produce video series with it. It has grown incredibly over the last year (especially after MS made it free).
One of the big reasons we use it is that we can reuse the business logic side of the code irrespective of the platform we target (this gives rise to the oft claimed 85% reusable code). Code something once, use it multiple times on completely different platforms and architectures.
Often someone will ask for an application to be written cross platform and for this ask for Xam.Forms to be used. There is nothing wrong in asking for that, it abstracts the UI so if you're careful, you can get away with just about zero required for the platform UI. Obviously, anything platform specific has to be grabbed via injection (for services such as network connectivity, anything hardware based or the likes of the common settings) or via a custom renderer (for UI work).
This leads to the question. If the UI does need custom renderers and information grabbed from the platform, are developers better off not using Forms, but going down the MVVM route and creating the UI natively? After all, creating a custom renderer and playing with DI are not always the simplest of things and therefore the time gained using Forms may turn out to be a false economy. Certainly code such as
var lblMyLabel = new Label {Text = "Hello world"};
is simpler than creating the UI on a Storyboard, Xaml designer or the Android designer then having to link that up to the code behind, but when you then consider that the designer will allow you to size, change colour and assign the text without pretty much doing anything else and more importantly, position on the view without having to work out where it goes in the StackLayout (or whichever layout you decide to use).
Given the number of people asking for forms development, I wonder how many have considered alternate routes and how many see forms to be that panacea resulting in very fast development and delivery times without either understanding the technology or the pitfalls of use.
I'll let you go back to sleep.
You are having a laugh yeah? Out of the two apps you did with forms with my company 1) had to be rewritten as forms was incapable of the visuals and full of visual defects. 2) only just hangs together and offers very clunky behaviour. you weren't able to find any visually compelling forms app when I asked. Seems it might be fit for purpose with basic data entry but for compelling/beautiful end user apps it is a no go.
Software Engineer / Owner of Titans B.V.
8 年Good read