Your SlideShare is downloading. ×
Sharing up to 80% code for iOS, Android, and Windows platforms, a Retail App Case Study, Roy Cornellisen and Marcel de Vries
Upcoming SlideShare
Loading in...5

Thanks for flagging this SlideShare!

Oops! An error has occurred.


Introducing the official SlideShare app

Stunning, full-screen experience for iPhone and Android

Text the download link to your phone

Standard text messaging rates apply

Sharing up to 80% code for iOS, Android, and Windows platforms, a Retail App Case Study, Roy Cornellisen and Marcel de Vries


Published on

Published in: Technology

  • Be the first to comment

No Downloads
Total Views
On Slideshare
From Embeds
Number of Embeds
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

No notes for slide


  • 1. Welcome!
  • 2. Sharing up to 80% ofcode building mobileapps for iOS, Android,WP8 and Windows 8 RoyCornelissenIT Architect,Info Supportper,Info SupportMarcelde VriesTechnologyManager@marcelvXamarinEvolve2013RoyCornelissenITArchitect@roycornelissen
  • 3. Key takeaways DemosArchitecture Tips & Tricks
  • 4. Showcase
  • 5. National web site, aimed at selling the “last availableseats” for theatre shows for up to 4 daysNo discount or auction site, but a source forinspiration for a fun night outOrder tickets from home, from a terrace or from yourhotel room
  • 6. Demo
  • 7. MindsetLessons we’ve learned over the yearsStuff that actually works in practiceNot only theoreticallyWe target iOS, Android and WindowsLeaving out Windows can give a different perspectiveon reuseShowcase: app for a retail startupCurrently being rebranded
  • 8. What we’ve heard the past few daysMany cross platform talksTalks on frameworksThis session is about a real app, notjust an exampleImportant: we also target WindowsVery different UI paradigms, impacts code structure andlevel of reuse
  • 9. Reusable34%Shared Logic17%Android10%iOS8%Windows Phone10%Services21%Shared84%Specific16%Per App
  • 10. Evaluate frameworksMonoCrossMvvmCrossRoll your ownFrameworks can help speed updevelopment but they might also limityour movements by (over)abstractionKeep as lightas possible
  • 11. DataSerializationCachingSecurityAuthN/AuthZEncryptionData Self DestructionUtilitiesAnalyticsLoggingDevice servicesPlatform Agnostic APIApplication Business LogicPlatform UIDesign Patterns for ReuseGlue together theapplication layers
  • 12. Navigation frameworksIn our experience, navigationframeworks yield leaky abstractions.E.g. PivotView navigation experienceis not the same as menu navigationvia UINavigationController.Leave UI navigation devicespecific
  • 13. WindowsOne pivotviewover multipledatarepresentations
  • 14. AndroidTab bar stylenavigation withseparateactivities
  • 15. ServicesModelControllerViewModelEtc.GPSStorageMotion sensorsViewShared?BridgeShared  Platform specific
  • 16. Model ImplementationWe implement the Model as a SingletonModel Implements INotifyPropertyChangedEasy to enlist subscribersFacilitate automatic databinding in XAMLModel contains rich features such as filtering andadvanced selectionsEasy to share logic
  • 17. Model Implementationpublic class MainModel : INotifyPropertyChanged{private static MainModel _model;private static object _lockHandle = new object();// Facilitates Windows Phone app resumepublic void RestoreState(MainModel state){_model = state;}public static MainModel Current{get {if (_model == null) {_model = new MainModel();}return _model;}}public IEnumerable<Event> ActualEvents {get {// E.g. Complex linq stuff}}}// Model Usage:var foo = MainModel.Current.ActualEvents;
  • 18. Check your water levelReusable Business LogicDevice SpecificXAML / ValueConverterModel PropertyValue Transformation
  • 19. public class ISKEController{private static ISKEController _instance;private ISKEDomainServicesoap _proxy;public static ISKEController Current{get {if (_instance == null) {_instance = new ISKEController();}return _instance;}}private void GetActualEvents (Action<object> OnSuccess, Action<Exception> OnFail){// do some logic, or service call// use actions to report result or trigger UI action}}
  • 20. Shared ControllerUIViewController XAML View ActivityWeb ServicesSFSFSFModelGetActualEvents(Action<object> OnSuccess,Action<Exception> OnFail)PropertyChanged(“Events”);public void OnFailed(Exception e){// Do something with error}public void OnSuccess(object data){// Do something with data// Notify user}
  • 21. Demo
  • 22. iOSMonoTouch.CoreLocationMonoTouch.CoreMotionMonoTouch.AVFoundationMonoTouch.AddressBookMonoTouch.EventKit…Android:Android.Hardware.SensorAndroid.LocationAndroid.BluetoothAndroid.Nfc…Windows Phone:Microsoft.Devices.Sensors.GyroscopeMicrosoft.Devices.Sensors.AccelerometerMicrosoft.Devices.Sensors.CompassMicrosoft.Devices.Sensors.Motion…
  • 23. Partial classes & methods
  • 24. partial class A{// Half of the implementation}partial class A{// The other half}A.cs A.extra.cs
  • 25. partial class A{// Declare the method herepartial void DoSomethingEx();public void DoSomething(){// Some shared logicDoSomethingEx();}}partial class A{// Provide the implementation herepartial void DoSomethingEx(){// Do something iOS specific}}Can be used from sharedlogicLeaves room for specificimplementationAlways private and returnsvoidA.cs A.iOS.cs
  • 26. Demo
  • 27. Services – Use soap?Proxy generationSilverlight tools: it needs to run on Windows too!What about bandwidth?
  • 28. Services – Use REST/JSON?WebAPI / ServiceStackMore hand codingCloud: Azure / Parse / Buddy
  • 29. Cross platform version controlGitHub, BitBucketVisualStudio.comWork items, builds
  • 30. Demo
  • 31. C# language tricksLeverage your tools
  • 32. Abstractions are goodBut don’t over-abstractDon’t over-engineerBeware of pitfalls…
  • 33. @roycornelissenroycornelissen.wordpress.comThank you!