Last week the Xamarin Partner Summit took place in Amsterdam. The Xamarin Partner Summit is a summit for partners of Xamarin funnily enough. Having the privilege of working with XABLU, a 100% Xamarin focussed company and a Xamarin premier consulting partner based in the Netherlands, we were duly invited.
There were two possible tracks to take; Business or Technical (Intermediate/Advanced). Naturally I followed the advanced technical track hosted by Colby Williams.
One of the key points I took away from the talk was the idea of modularizing your code. Xamarin always promotes the idea of code reuse between platforms, but what about reusing code between applications. When writing code, we should not be writing to only satisfy the current problem we are solving, but think of writing the code in a way that can be reused.
This involves naming your methods and classes with a more generic convention and abstracting them appropriately. Then, instead of copy pasting this code between projects, create Nuget packages. An added benefit to this is that you have access to some versioning functionality allowing you to have appropriate versions of the package in different applications.
Another important and simpler way of modularizing your code is to use plugins as often as possible. You don’t need me to tell you the benefits of avoiding the reinvention of established code solutions.
Not really an advanced topic but it goes without saying that you should provide the correct image sizes as they will be displayed in the application, this avoids the device having to resize your image every time it is used, causing memory and performance issues.
What was interesting was to hear how many of the other Xamarin experts implement their images. Most implemented them in the traditional way (5 different pixel density versions in Android and 3 in iOS). Some, including myself a couple times, used fonts. This surprised Colby as he uses and expected others to use Vectors (pdf in iOS). This provides a better solution for scaling between devices and avoiding the aforementioned pitfalls. However, vectors come with their own problems which are mentioned in this article by Florina Muntenescu.
Do a search for the amount of += that are in your solution, then compare them to the amount of -= in your solution. If there are more += than -= then you may be leaking some memory. Care must be taken to remove any event handler delegates, otherwise the garbage collection will not be able to clear the memory. This can be done in the relevant lifecycle event of the view/class.
Sometimes a contentious issue between Xamarin developers, we were hesitantly asked for our views on this platform. There needn’t have been any hesitation as everyone seemed to be fairly open minded and almost all on the same page.
The consensus was that Forms is useful in certain scenarios and circumstances, but ultimately it was a magic pill that was not a long term solution for any application.
Forms constrains the UI designer, which will have an impact on the end user experience, and end users don’t care about how much code you managed to share between platforms. To provide a custom platform specific UI for the end user, custom renderers will have to be made for every page and for every platform, defeating the purpose of Forms being the ultimate code sharing tool.
Furthermore, Forms hides the underlying platform specific environment, preventing the developer from having a real understanding of the platform and mobile development.
However, the appeal of forms is understandable. Many companies have .Net developers with C# and XAML skills that can be transferred into the Xamarin Forms environment. And with companies realising that they must have a mobile solution, backed by the lack of Xamarin professionals available, Xamarin Forms seems like a perfect solution.[/cs_text][/cs_column][/cs_row]
The event was a great experience. The best part was the chance to talk with many Xamarin developers from around the world about our thoughts, concerns and excitement for the future.