Pt xug xamarin pratices on big ui consumer apps
-
Upload
alexandre-marreiros -
Category
Technology
-
view
524 -
download
0
Transcript of Pt xug xamarin pratices on big ui consumer apps
Alexandre Marreiros
Speaker
CTO @ Innovagency Software Dev/Arch as Independent Technical Trainer and Speaker as Independent Teacher @ EDIT Technical Writer Windows Platform Development Microsoft MVP Microsoft Windows DevCamp Trainer Windows Insider
C:\> ping me @alexmarreiros
Xamarin Share codeshared project:+ Can use #if when targeting multiple platforms (e. g. Xamarin iOS, Android, WinPhone)+ All framework functionality available for each target project (though has to be conditionally compiled)o Integrates at compile time- Slightly larger size of resulting assembliespcl:+ generates a shared assembly+ usable with older versions of Visual Studio (pre-2013 Update 2)o dynamically linked- limited functionality (subset of all projects it is being referenced by)
Xamarin PerformanceMemmory
• Keep your objecs small and lightweight and cache them
• Don´t Dispose objects that will be needed a lot (minimize the allocations that can lead to memmory fragmentation)
• Keep a profiler over your application in development time
• Choose Weak References everytime you can
Xamarin PerformanceNot everithing is Disposable, bus tonly when
• Class owns a Disposable object;
• Class owns and masters a unmanaged resource;
Xamarin PerformanceMemmory
• Use wisely Weak References and Singleton objectspublic class B {
readonly WeakReference<A> aWeakRef;
public B (A a) { aWeakRef = new WeakReference<A> (a);
} }
Xamarin PerformanceBe carefull Wth Memmory Leaks associated with Events
public void Dispose () { publisher.MyEvent -= OnMyEventFires;
}
Xamarin PerformanceIn .NET you usually forget Garbage Collection in Xamrin you Can’t
A wise use of garbage collection is fundamental especially when you are facing high levels of abstration like in Xamarin Forms
• Reuse your objects, implementing concepts of Object Pool
• Explicitly release Idisposable objects
Xamarin PerformanceOptimize the app release in terms of Size and pre compilation
Enabe Linker in the build tools and analyze what your app really need
In the case of Xamarin Forms enable the XAML Compiler
Xamarin PerformanceSometimes you need to create your own control face that...
Even if it will be easier to use a stack or grid layout to grant the correct position of an element don’t do that using a list layout that is created to retain multiple childs and not just one (avoid in this cases Stack Layout or Grid Layout)
Xamarin UI tricks
Give users graphic information and use animation tricks to granmt he does not thinks in the time app needs to process
UI between devices Use Responsive Patterns to an excelent experience
• Column Drop;
• Hiden Visual Object;
• Rendering acording with device width not device type;
• Remember wht you had learn in Object Oriented aproaches
UI between devices Performance is not just about code is about UI and UX approaches
Cross Platform can be viewed in different layer’s not allways full reuse is full mantainable or full time clever
Never forget to understand how target platforms works and how we link with them in Xamrin
References• Jesse Liberty sports billy code bag;
• Xamarin University (avoid common pitfalls in Xamarin APPS)
• Jason White Xamarin secrets presentation
• Xamarin best Prtices documentation