pt xug xamarin pratices on big ui consumer apps

42
Lisbon, 30 th January 2016 Xamarin pratices on big ui consumer apps PTXug

Upload: alexandre-marreiros

Post on 17-Feb-2017

524 views

Category:

Technology


0 download

TRANSCRIPT

Lisbon, 30th January 2016

Xamarin pratices on big ui consumer apps

PTXug

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

[email protected]

Once upon a time

A client with a technical DNA

Once upon a timeWho want’s a Ritch Design E-comerceApplication

Once upon a time

Once upon a time

Once upon a time

Once upon a time

Business people starts to think the APP Requirements

Once upon a time

Native APPS Designer’sStrat their work

Once upon a timeDevelopment team do this, with Xamarin Forms

Once upon a time

Once upon a time

Xamarin Basics

Xamarin Basics

Xamarin Basics

How .net runs in no Microsoft Devices ?

Xamarin Basics

Xamarin Basics

Xamarin Basics

Xamarin Basics typical aproaches

Xamarin Share code

PCLSharedProject

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 Share code

Xamarin Share code

Xamarin Performance

Always remember Performance good pratices in your code

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 custom render

Custom Renderer Pattern

Xamarin UI tricks

Give users graphic information and use animation tricks to granmt he does not thinks in the time app needs to process

Xamarin Forms

Diferent experience between different devices ( tablet vs phone ) in the same OS

Xamarin Forms Prefer ResponsiveUI aproaches instead of Adaptative UI aproaches

Xamarin Forms or not

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

Q & A

References• Jesse Liberty sports billy code bag;

• Xamarin University (avoid common pitfalls in Xamarin APPS)

• Jason White Xamarin secrets presentation

• Xamarin best Prtices documentation

Sponsors

THANK YOU !C:\> ping me

@alexmarreiros