Xamarin Forms, MVVM and Testing
Speaker
Basic(1989) C(1991) C++(1997) Java(1997)C#(2005) JavaScript(2008) Others Languages
with Xamarin Forms for 8 Months iOS with Xamarin Forms for 3 Weeks Android
Xamarin
C# 3.0 (2007)Java 8 (2014) C# 5.0 (2013) C# 4.0 (2010) Lambda Expression Trees LINQ Lambda Streams Dynamic Asynchronous
Native • Native User Interfaces • Native API Access • Native Performance
Xamarin Forms
App Logics Cross-platform Natively Backed UI Platform-specific API iOS Platform-specific API Android Platform-specific API Windows Phone
XAML • Extensible Application Markup Language • XML • WPF(2006) • 2-way Binding • Data Templating
Model View ViewModel
MVVM(Model-View-ViewModel) • In 2005, John Gossman(Microsoft) • A Variation of MVC • Separation of Presentation and Presentation Logic • 2-way Binding • Testability • WPF, Silverlight, Xamarin Forms, AngularJS, EmberJS, KnockoutJS, RoboBinding • Introduction to Model/View/ViewModel pattern for building WPF apps • WPF Apps With The Model-View-ViewModel Design Pattern
ViewModel • An Abstraction of a View • State and Behavior • Does not need a reference to a view
ViewModel Presentation Logic View User Interface Model Business Logic and Data 2-way Binding
Unit Testing
Unit Testing Pros • Cheap • Finds problems early • Living Documentation • As a Design Element Cons • Not catch integration errors • Not catch system-level errors • Can’t write for user interfaces
Presentation Layer View(UI) ViewModel(Presentation Logic) • No Reference to Views • No Lifecycle Constraint Testable
Bindings
Bindings • Properties • Collections and Templating • Commands
Properties <Entry Text="{Binding NameEntry}" />
Collections and Templating <ListView ItemsSource="{Binding Users}"> <ListView.ItemTemplate> <DataTemplate> <ViewCell> <Label Text="{Binding Name}" /> </ViewCell> </DataTemplate> </ListView.ItemTemplate> </ListView>
Commands <Button Command="{Binding Add}" />
Events
Events • PropertyChanged • CollectionChanged • CanExecuteChanged
Properties • INotifyPropertyChanged • PropertyChanged
Collection • INotifyCollectionChanged • CollectionChanged
Commands • ICommand • CanExecute • CanExecuteChanged
Summary
Xamarin • C# • Native • Visual Studio • Designer
Xamarin Forms • Cross-platform Natively Backed UI • XAML • 2-way Binding • Data Templating
MVVM • Separation of Presentation and Presentation Logic • 2-way Binding • Testability • Property, Collection, Command • PropertyChanged, CollectionChanged, CanExecuteChanged

Xamarin Forms, MVVM and Testing