building cross platform mobile solutions

46
Building Cross Platform Mobile Solutions

Upload: qframe

Post on 07-May-2015

505 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Building Cross Platform Mobile Solutions

Building Cross Platform Mobile Solutions

Page 2: Building Cross Platform Mobile Solutions

@gittetitterproq.blogspot.com

Building Cross Platform Mobile Solutions

Gitte Vermeiren

Page 3: Building Cross Platform Mobile Solutions
Page 4: Building Cross Platform Mobile Solutions

My perfect mobile world ...

Page 5: Building Cross Platform Mobile Solutions

My perfect mobile world ...

Page 6: Building Cross Platform Mobile Solutions

My perfect mobile world ...

Page 7: Building Cross Platform Mobile Solutions

My perfect mobile world ...

Data Access

Business Logic

Service Interface

Business Logic

UI Logic

WP iOS Droid Win8

Business Logic

Business Logic

Business Logic

UI Logic UI Logic UI Logic

Service Consumptio

n

Local Data/Servic

es

Service Consumptio

n

Local Data/Servic

es

Service Consumptio

n

Local Data/Servic

es

Service Consumptio

n

Local Data/Servic

es

Page 8: Building Cross Platform Mobile Solutions

My perfect mobile world ...

Data Access

Business Logic

Service Interface

Service Consumption Local Data/Services

Business Logic

UI Logic

WP iOS Droid Win8

Page 9: Building Cross Platform Mobile Solutions

My perfect mobile world ...

Data Access

Business Logic

Service Interface

Service Consumption Local Data/Services

Business Logic

UI Logic

WP iOS Droid Win8

Page 10: Building Cross Platform Mobile Solutions

My perfect mobile world ...

Data Access

Business Logic

Service Interface

Service Consumption Local Data/Services

Business Logic

UI Logic

WP iOS Droid Win8

Page 11: Building Cross Platform Mobile Solutions

My perfect mobile world ...

Data Access

Business Logic

Service Interface

Service Consumption Local Data/Services

Business Logic

UI Logic

WP iOS Droid Win8

Page 12: Building Cross Platform Mobile Solutions

Can we do this?

Portable Class

LibrariesXamarin MvvmCros

s

Page 13: Building Cross Platform Mobile Solutions

Intro

Page 14: Building Cross Platform Mobile Solutions

How did we do this?

Portable Class

LibrariesXamarin MvvmCros

s

Page 15: Building Cross Platform Mobile Solutions

Portable Class Library

- Share code across platforms

Page 16: Building Cross Platform Mobile Solutions

Portable Class LibraryWindows Store App

Startup

Views

Windows Phone App

Startup

Views

PCL

ViewModels

Models

AndroidApp

Startup

Views

iOSApp

Startup

Views

references

references

references

references

Page 17: Building Cross Platform Mobile Solutions

Demo: Portable Class Library

Page 18: Building Cross Platform Mobile Solutions

How did we do this?

Portable Class

LibrariesXamarin

Page 19: Building Cross Platform Mobile Solutions

Xamarin for Android/iOS

Page 20: Building Cross Platform Mobile Solutions

Xamarin for Android/iOS

Business Logic

UI Logic

WP iOS Droid Win8

Data Access

Business Logic

Service Interface

Service Consumption Local Data/Services

Xamarin

Page 21: Building Cross Platform Mobile Solutions

Xamarin for Android/iOS

Code Completio

n for Native APIs

Visual Studio

Integration

Advanced Debugging

Support

Point and click UI design

Page 22: Building Cross Platform Mobile Solutions

Xamarin for Android/iOS

Page 23: Building Cross Platform Mobile Solutions

Xamarin for Android/iOS

Page 24: Building Cross Platform Mobile Solutions

Demo: Xamarin for Android

Page 25: Building Cross Platform Mobile Solutions

Getting Started

- Windows PC or Mac

- Google Play account / iOS account

- Xamarin for Android / Xamarin for iOS: free – 999$

Page 26: Building Cross Platform Mobile Solutions

How did we do this?

Xamarin MvvmCross

Page 27: Building Cross Platform Mobile Solutions

Data Binding (binder)

M-V-VM

View ViewModel

Events

DataModelData

Page 28: Building Cross Platform Mobile Solutions

M-V-VMSeparati

on of Concerns

Designable (Blend)

More structure

d code

TestableDatabinding

Code reuse

Page 29: Building Cross Platform Mobile Solutions

MvvmCross

Page 30: Building Cross Platform Mobile Solutions

MvvmCross

Data Binding (binder)

View ViewModel

Events

DataModelData

WP View

iOS View

Android View

Win 8 View

Page 31: Building Cross Platform Mobile Solutions

MvvmCross

Android

WP/Win8

HomeViewModel SessionsViewModel

SessionDetailViewModel

iOS

RequestNavigate

RequestNavigate

Page 32: Building Cross Platform Mobile Solutions

MvvmCross

Your appDevice SpecificPlugin

IMvxNativeColor

MvxWinRTColor Add Plugin

MvxAndroidColor Add Plugin

MvxWPColor Add Plugin

Page 33: Building Cross Platform Mobile Solutions

MvvmCross

Page 34: Building Cross Platform Mobile Solutions

Demo: MvvmCross ‘Backend’

Page 35: Building Cross Platform Mobile Solutions

MvvmCross

- ViewModels- DI- Services/Plugins- Navigation- Unit test

Page 36: Building Cross Platform Mobile Solutions

MvvmCross

Data Binding (binder)

ViewModel

Events

DataModelData

WP View

iOS View

Android View

Win 8 View

Page 37: Building Cross Platform Mobile Solutions

Demo: MvvmCross WP

Page 38: Building Cross Platform Mobile Solutions

A WP app with MvvmCross

- Data Binding as you know it- ViewModels are auto-wired using

MvxPhonePage<TViewModel>- Configure platform specific services

... and that’s it

Page 39: Building Cross Platform Mobile Solutions

Demo: MvvmCross Android

Page 40: Building Cross Platform Mobile Solutions

An Android app with MvvmCross

- UI is build up using .axml - Data Binding using json expressions- Navigation mapped to Intents- ViewModels are auto-wired using

MvxBindingActivityView<TViewModel>- ValueConverters can be used

Page 41: Building Cross Platform Mobile Solutions

Lessons Learned

Page 42: Building Cross Platform Mobile Solutions

Why this became my precious

- Native UI- Native Performance- One language to rule them all- 95% shared application logic- 100% shared test harness- Overall dev time ≈ dev time per app- Changes can be done in 1 place (most of the time)

Page 43: Building Cross Platform Mobile Solutions

Why this became my precious

Portable Class

LibrariesXamarin MvvmCros

s

Page 44: Building Cross Platform Mobile Solutions

Related Sessions

- Coding and designing for Windows 8 and Windows Phone 8, best practices and reusing code

- Laurent Bugnion- Applied MVVM in Windows 8 apps: not your typical MVVM

session!- Gill Cleeren

- Live coding: The Windows Store Apps showdown - C# vs JavaScript

- Iris Classon

Page 45: Building Cross Platform Mobile Solutions

Other Resources

- MvvmCross- https://github.com/slodge/MvvmCross- http://slodge.blogspot.com

- Xamarin- http://xamarin.com/- monogame.net

- The bits- https://github.com/vermegi/TechdaysBeDemo

Page 46: Building Cross Platform Mobile Solutions

Thanks!

@gittetitterproq.blogspot.com