MobileCross PlatformDesign Patterns
Roy CornelissenIT Architect,Info Support
Willem MeintsDeveloper,Info Support
Roy CornelissenIT ArchitectInfo Support
Dutch Mobile .NET Developers Group
Patterns Proof
Context ALM
C / C++
Different CPU
architectures
C# / XAML
Demo
App Logic
Vendor tools “Magic Box” Hybrid
XCode
Objective-C
WP8 / WinRT
XAML
C#
Android
SDK
Java
Appcelerator
Titanium
JavaScript > Native
PhoneGapHTML5 / CSS / JS
Adobe AIR
ActionScript
Antenna
Rapid
Scripting
Language
Service2Media
Lua C#
XamarinMonoTouch
Visual StudioXAML, C#, WinRT Xamarin
Mono for Android
Rhodes
Ruby + HTML
Sybase
Unwired
“4GL” code genShared
language
Reusable
20%
Shared app
logic
20%Windows8
14%
iOS
18%
WP7
12%
Android
16%
Shared
65%
Specific
35%
Per App
Services
Model
ControllerViewModel
Etc.
GPS
Storage
Motion sensors
View
Shared?
Bridge
Shared Platform specific
Shared Controller
UIViewController XAML View Activity
Web Services
SF
SF
SF
Model
GetActualEvents(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
}
iOS
MonoTouch.CoreLocation
MonoTouch.CoreMotion
MonoTouch.AVFoundation
MonoTouch.AddressBook
MonoTouch.EventKit
…
Android:
Android.Hardware.Sensor
Android.Location
Android.Bluetooth
Android.Nfc
…
Windows Phone:
Microsoft.Devices.Sensors.Gyroscope
Microsoft.Devices.Sensors.Accelerometer
Microsoft.Devices.Sensors.Compass
Microsoft.Devices.Sensors.Motion
…
Workshop Mobile Development - Patterns for reuse
partial class A
{
// Half of the implementation
}
partial class A
{
// The other half
}
A.cs A.extra.cs
partial class A
{
// Declare the method here
partial void DoSomethingEx();
public void DoSomething()
{
// Some shared logic
DoSomethingEx();
}
}
partial class A
{
// Provide the implementation here
partial void DoSomethingEx()
{
// Do something iOS specific
}
}Can be used from shared
logic
Leaves room for specific
implementation
Always private and returns
void
A.cs A.iOS.cs
Roy Cornelissen@roycornelissen
Questions?
Top Related