SlideShare uma empresa Scribd logo
1 de 50
Baixar para ler offline
MvvmCross Introduction

    13th December 2012
          @slodge
Presentation Model


Represent the state and behavior of the presentation
   independently of the GUI controls used in the
                      interface.




             http://martinfowler.com/eaaDev/PresentationModel.html
In 2005…

      Model/View/ViewModel is a variation of
Model/View/Controller that is tailored for modern UI
   development platforms where the View is the
  responsibility of a designer rather than a classic
                      developer.


                            Tales from the Smart Client, John Grossman
  http://blogs.msdn.com/b/johngossman/archive/2005/10/08/478683.aspx
Also in 2005…
• 10 years of dev – C++, C, VB, Java, JavaScript,
  LISP, SmallTalk, Delphi, …
• A year off travelling
  – from Argentina to Zambia
• DeveloperDeveloperDeveloper
• 1 conclusion:
MvvmCross Introduction
   Evolving the dinosaur
    13th December 2012
          @slodge
What we’ll cover…
•   MVVM Theory
•   .Net MVVM
•   A practical example – some code!
•   Interface Driven Development
    – Portable Class Libraries
    – Unit Testing
    – Plugins
• Some examples
What we’ll cover…
•   MVVM Theory
•   .Net MVVM
•   A practical example – some code!
•   Interface Driven Development
    – Portable Class Libraries
    – Unit Testing
    – Plugins
• Some examples
M-V-VM
Detailed flow
What we’ll cover…
•   MVVM Theory
•   .Net MVVM
•   A practical example – some code!
•   Interface Driven Development
    – Portable Class Libraries
    – Unit Testing
    – Plugins
• Some examples
ViewModels Public Properties

private bool _isSearching;
public bool IsSearching
{
     get { return _isSearching; }
     set
     {
          _isSearching = value;
          RaisePropertyChanged("IsSearching");
     }
}
For ViewModel Changes

public interface INotifyPropertyChanged
{
     event PropertyChangedEventHandler PropertyChanged;
}


public class PropertyChangedEventArgs : EventArgs
{
     public string PropertyName { get; }
}
For Collections
public interface INotifyCollectionChanged
{
     event NotifyCollectionChangedEventHandler CollectionChanged;
}

public enum NotifyCollectionChangedAction
{
     Add, Remove, Replace, Move, Reset,
}

public class NotifyCollectionChangedEventArgs : EventArg
{
     public NotifyCollectionChangedAction Action { get; }
     public IList NewItems { get; }
     public IList OldItems { get; }
     public int NewStartingIndex { get; }
     public int OldStartingIndex { get; }
}
For Actions


public interface ICommand
{
    event EventHandler CanExecuteChanged;
    bool CanExecute(object parameter);
    void Execute(object parameter);
}
.Net Implementation


     ICommand
  Public Property Set



   INotifyPropertyChanged
  INotifyCollectionChanged
     Public Property Get
Why?
To Enable
• Awesome UI and Data Development
• Unit Testing of code
• Large applications to have a common
  architecture
• Different platforms can share code
What we’ll cover…
•   MVVM Theory
•   .Net MVVM
•   A practical example – some code!
•   Interface Driven Development
    – Portable Class Libraries
    – Unit Testing
    – Plugins
• Some examples
What is MvvmCross?


      Code!
Code evolution I
•   Single Mono for Android Project
•   Good separation of UI from ‘Model’ code
•   Simple – it works
•   But:
    – No testing
    – No testability
    – Portability by cut/paste
Code Evolution 2
• MvvmCross Library switched in
  – PCL code
  – Formal DI/IoC used
• On UI:
  – DataBinding arrived
  – Code got much thinner!
  – XML got bigger
• Not all win:
  – External Dependencies got larger
  – Code overall increased in size
Code Evolution 3
• Cross Platform
• All UIs MVVM
• 100% shared application
  logic
• 100% shared test harness
Data-Binding
WP/WinRT
 99% Xaml




   Droid
Mainly Axml
Some .Dialog




  Touch
Some .Dialog
 Some .XIB
  Some C#
What we’ll cover…
•   MVVM Theory
•   .Net MVVM
•   A practical example – some code!
•   Interface Driven Development
    – Portable Class Libraries
    – Unit Testing
    – Plugins
• Some examples
Portable Class Libraries
Unit Testing
“I get paid for code that works, not for tests, so my
philosophy is to test as little as possible to reach a
given level of confidence.
…
When coding on a team, I modify my strategy to
carefully test code that we, collectively, tend to get
wrong.”
                                                Kent Beck
                http://stackoverflow.com/questions/153234/how-deep-are-your-unit-tests
Plugin – Native abstractions
1. Declare common functionality (an interface)
   public interface IMvxComposeEmailTask
   {
       void ComposeEmail(string to, string cc, string subject, string body, bool isHtml);
   }

2. Write platform specific implementations
  public class MvxComposeEmailTask : MvxWindowsPhoneTask, IMvxComposeEmailTask
  {
       public void ComposeEmail(string to, string cc, string subject, string body, bool isHtml)
       {
           var task = new EmailComposeTask() { To = to, Subject = subject, Cc = cc, Body = body };
           DoWithInvalidOperationProtection(task.Show);
       }
    }

3. In apps, use the interface and not the implementation
   protected void ComposeEmail(string to, string subject, string body)
   {
        Cirrious.MvvmCross.Plugins.Email.PluginLoader.Instance.EnsureLoaded();
        var task = this.GetService<IMvxComposeEmailTask>();
        task.ComposeEmail(to, null, subject, body, false);
   }
Sphero – Plugin Magic
• Plugin Magic

• Each Plugin:
   – 1 PCL
   – 1 Assembly per platform
Why?
To Enable
• Awesome UI and Data Development
• Unit Testing of code
• Large applications to have a common
  architecture
• Different platforms can share code
What we’ll cover…
•   MVVM Theory
•   .Net MVVM
•   A practical example – some code!
•   Interface Driven Development
    – Portable Class Libraries
    – Unit Testing
    – Plugins
• Some examples
MonoCross
A team in a galaxy far far away




@imaji @mrlacey @sichy @slodge @touch4apps …
Redth in Canada




https://github.com/Redth/WshLst/
Rune in Norway




https://github.com/runegri/CrossBox
Jason in UK




http://www.aviva.co.uk/drive/
CheeseBaron in Denmark




http://blog.ostebaronen.dk/
Greg in NYC




http://bit.ly/mvxgshac
JSON.Net Downunder (?)
Olivier in France




http://www.e-naxos.com/UsIndex.html
Dan in Italy




http://bit.ly/mvxDanA
Zoldeper in Hungary?




https://github.com/Zoldeper/Blooor
Daniel in Redmond




http://channel9.msdn.com/Events/Build/2012/3-004
What we’ve covered…
•   MVVM Theory
•   .Net MVVM
•   A practical example – some code!
•   Interface Driven Development
    – Portable Class Libraries
    – Unit Testing
    – Plugins
• Some examples
To join in…
If you want to join in:
   •   Tool up
   •   Share
   •   Reuse
   •   Test
   •   Architect
MS-PL on GitHub




http://github.com/slodge/MvvmCross
Some other talks available




http://bit.ly/mvxTweetPic
C# - 1 Stack - Cloud to Mobile
Data Access

Business Logic

Presentation


Service Consumption         Local Data/Services

Business Logic

UI Logic

WP7                   iOS   Droid                 Win8
Not as cool as dinosaurs
Data Access

Business Logic

Presentation


Service Consumption         Local Data/Services

Business Logic

UI Logic

WP7                   iOS   Droid                 Win8
Some credits
Images from Wikipedia Commons:
•   http://en.wikipedia.org/wiki/File:Macronaria_scrubbed_enh.jpg
•   http://en.wikipedia.org/wiki/File:Human-
    eoraptor_size_comparison%28v2%29.png



Diagrams from Java – ZK
•   http://books.zkoss.org/wiki/ZK_Developer%27s_Reference/MVVM



Sample projects as credited inline
Thanks for listening…
http://cirrious.com

http://slodge.blogspot.com
http://github.com/slodge/mvvmcross

me@slodge.com
@slodge

Stuart Lodge,
I’m a Dinosaur
Xamarin
               Seminar
Please give us your feedback
              http://bit.ly/xamfeedback


Follow us on Twitter
                       @XamarinHQ

13th December 2012

Mais conteúdo relacionado

Mais procurados

Managing Software Dependencies and the Supply Chain_ MIT EM.S20.pdf
Managing Software Dependencies and the Supply Chain_ MIT EM.S20.pdfManaging Software Dependencies and the Supply Chain_ MIT EM.S20.pdf
Managing Software Dependencies and the Supply Chain_ MIT EM.S20.pdfAndrew Lamb
 
Containerizing legacy applications
Containerizing legacy applicationsContainerizing legacy applications
Containerizing legacy applicationsAndrew Kirkpatrick
 
There is something about JavaScript - Choose Forum 2014
There is something about JavaScript - Choose Forum 2014There is something about JavaScript - Choose Forum 2014
There is something about JavaScript - Choose Forum 2014jbandi
 
Introduction to Java Programming Language
Introduction to Java Programming LanguageIntroduction to Java Programming Language
Introduction to Java Programming LanguageJunji Zhi
 
Behaviour testing for single-page applications and API’s
Behaviour testing for single-page applications and API’sBehaviour testing for single-page applications and API’s
Behaviour testing for single-page applications and API’sAndrew Kirkpatrick
 

Mais procurados (7)

Managing Software Dependencies and the Supply Chain_ MIT EM.S20.pdf
Managing Software Dependencies and the Supply Chain_ MIT EM.S20.pdfManaging Software Dependencies and the Supply Chain_ MIT EM.S20.pdf
Managing Software Dependencies and the Supply Chain_ MIT EM.S20.pdf
 
Containerizing legacy applications
Containerizing legacy applicationsContainerizing legacy applications
Containerizing legacy applications
 
There is something about JavaScript - Choose Forum 2014
There is something about JavaScript - Choose Forum 2014There is something about JavaScript - Choose Forum 2014
There is something about JavaScript - Choose Forum 2014
 
Introduction to Java Programming Language
Introduction to Java Programming LanguageIntroduction to Java Programming Language
Introduction to Java Programming Language
 
Exploring French Job Ads, Lynn Cherny
Exploring French Job Ads, Lynn ChernyExploring French Job Ads, Lynn Cherny
Exploring French Job Ads, Lynn Cherny
 
Behaviour testing for single-page applications and API’s
Behaviour testing for single-page applications and API’sBehaviour testing for single-page applications and API’s
Behaviour testing for single-page applications and API’s
 
.NET Vs J2EE
.NET Vs J2EE.NET Vs J2EE
.NET Vs J2EE
 

Destaque (8)

18.lifenet benkyo kai
18.lifenet benkyo kai18.lifenet benkyo kai
18.lifenet benkyo kai
 
29.2010 1128 mf_forum
29.2010 1128 mf_forum29.2010 1128 mf_forum
29.2010 1128 mf_forum
 
11.2010 0528 tbli_lip
11.2010 0528 tbli_lip11.2010 0528 tbli_lip
11.2010 0528 tbli_lip
 
Nature Of Sound
Nature Of SoundNature Of Sound
Nature Of Sound
 
02.his 2011 0305
02.his 2011 030502.his 2011 0305
02.his 2011 0305
 
17.edu forum
17.edu forum17.edu forum
17.edu forum
 
16.2010 0829 b4_s_seminar
16.2010 0829 b4_s_seminar16.2010 0829 b4_s_seminar
16.2010 0829 b4_s_seminar
 
Forum flyer2012 v2
Forum flyer2012  v2Forum flyer2012  v2
Forum flyer2012 v2
 

Semelhante a MvvmCross Introduction

TypeScript - Javascript done right
TypeScript - Javascript done rightTypeScript - Javascript done right
TypeScript - Javascript done rightWekoslav Stefanovski
 
Latest trends in information technology
Latest trends in information technologyLatest trends in information technology
Latest trends in information technologyEldos Kuriakose
 
Get Started with JavaScript Frameworks
Get Started with JavaScript FrameworksGet Started with JavaScript Frameworks
Get Started with JavaScript FrameworksChristian Gaetano
 
An introduction to Node.js
An introduction to Node.jsAn introduction to Node.js
An introduction to Node.jsKasey McCurdy
 
Meetup. Technologies Intro for Non-Tech People
Meetup. Technologies Intro for Non-Tech PeopleMeetup. Technologies Intro for Non-Tech People
Meetup. Technologies Intro for Non-Tech PeopleIT Arena
 
Node.js meetup at Palo Alto Networks Tel Aviv
Node.js meetup at Palo Alto Networks Tel AvivNode.js meetup at Palo Alto Networks Tel Aviv
Node.js meetup at Palo Alto Networks Tel AvivRon Perlmuter
 
The NRB Group mainframe day 2021 - Containerisation on Z - Paul Pilotto - Seb...
The NRB Group mainframe day 2021 - Containerisation on Z - Paul Pilotto - Seb...The NRB Group mainframe day 2021 - Containerisation on Z - Paul Pilotto - Seb...
The NRB Group mainframe day 2021 - Containerisation on Z - Paul Pilotto - Seb...NRB
 
Containers: DevOp Enablers of Technical Solutions
Containers: DevOp Enablers of Technical SolutionsContainers: DevOp Enablers of Technical Solutions
Containers: DevOp Enablers of Technical SolutionsJules Pierre-Louis
 
Node.js In The Enterprise - A Primer
Node.js In The Enterprise - A PrimerNode.js In The Enterprise - A Primer
Node.js In The Enterprise - A PrimerNaveen S.R
 
Mobile app-and-microservices-with-ibm-cloud
Mobile app-and-microservices-with-ibm-cloudMobile app-and-microservices-with-ibm-cloud
Mobile app-and-microservices-with-ibm-cloudSrinivasan Nanduri
 
Demystifying Containerization Principles for Data Scientists
Demystifying Containerization Principles for Data ScientistsDemystifying Containerization Principles for Data Scientists
Demystifying Containerization Principles for Data ScientistsDr Ganesh Iyer
 
Microservice pitfalls
Microservice pitfalls Microservice pitfalls
Microservice pitfalls Mite Mitreski
 
Reaktive Programmierung mit den Reactive Extensions (Rx)
Reaktive Programmierung mit den Reactive Extensions (Rx)Reaktive Programmierung mit den Reactive Extensions (Rx)
Reaktive Programmierung mit den Reactive Extensions (Rx)NETUserGroupBern
 
The State of the Veil Framework
The State of the Veil FrameworkThe State of the Veil Framework
The State of the Veil FrameworkVeilFramework
 
Application Centric Microservices from Redhat Summit 2015
Application Centric Microservices from Redhat Summit 2015Application Centric Microservices from Redhat Summit 2015
Application Centric Microservices from Redhat Summit 2015Ken Owens
 

Semelhante a MvvmCross Introduction (20)

TypeScript - Javascript done right
TypeScript - Javascript done rightTypeScript - Javascript done right
TypeScript - Javascript done right
 
Latest trends in information technology
Latest trends in information technologyLatest trends in information technology
Latest trends in information technology
 
Training: MVVM Pattern
Training: MVVM PatternTraining: MVVM Pattern
Training: MVVM Pattern
 
Get Started with JavaScript Frameworks
Get Started with JavaScript FrameworksGet Started with JavaScript Frameworks
Get Started with JavaScript Frameworks
 
An introduction to Node.js
An introduction to Node.jsAn introduction to Node.js
An introduction to Node.js
 
Meetup. Technologies Intro for Non-Tech People
Meetup. Technologies Intro for Non-Tech PeopleMeetup. Technologies Intro for Non-Tech People
Meetup. Technologies Intro for Non-Tech People
 
Node.js meetup at Palo Alto Networks Tel Aviv
Node.js meetup at Palo Alto Networks Tel AvivNode.js meetup at Palo Alto Networks Tel Aviv
Node.js meetup at Palo Alto Networks Tel Aviv
 
Java1 in mumbai
Java1 in mumbaiJava1 in mumbai
Java1 in mumbai
 
The NRB Group mainframe day 2021 - Containerisation on Z - Paul Pilotto - Seb...
The NRB Group mainframe day 2021 - Containerisation on Z - Paul Pilotto - Seb...The NRB Group mainframe day 2021 - Containerisation on Z - Paul Pilotto - Seb...
The NRB Group mainframe day 2021 - Containerisation on Z - Paul Pilotto - Seb...
 
The Future of Cloud Innovation, featuring Adrian Cockcroft
The Future of Cloud Innovation, featuring Adrian CockcroftThe Future of Cloud Innovation, featuring Adrian Cockcroft
The Future of Cloud Innovation, featuring Adrian Cockcroft
 
Stackato v5
Stackato v5Stackato v5
Stackato v5
 
Containers: DevOp Enablers of Technical Solutions
Containers: DevOp Enablers of Technical SolutionsContainers: DevOp Enablers of Technical Solutions
Containers: DevOp Enablers of Technical Solutions
 
Node.js In The Enterprise - A Primer
Node.js In The Enterprise - A PrimerNode.js In The Enterprise - A Primer
Node.js In The Enterprise - A Primer
 
Mobile app-and-microservices-with-ibm-cloud
Mobile app-and-microservices-with-ibm-cloudMobile app-and-microservices-with-ibm-cloud
Mobile app-and-microservices-with-ibm-cloud
 
Demystifying Containerization Principles for Data Scientists
Demystifying Containerization Principles for Data ScientistsDemystifying Containerization Principles for Data Scientists
Demystifying Containerization Principles for Data Scientists
 
Stackato v6
Stackato v6Stackato v6
Stackato v6
 
Microservice pitfalls
Microservice pitfalls Microservice pitfalls
Microservice pitfalls
 
Reaktive Programmierung mit den Reactive Extensions (Rx)
Reaktive Programmierung mit den Reactive Extensions (Rx)Reaktive Programmierung mit den Reactive Extensions (Rx)
Reaktive Programmierung mit den Reactive Extensions (Rx)
 
The State of the Veil Framework
The State of the Veil FrameworkThe State of the Veil Framework
The State of the Veil Framework
 
Application Centric Microservices from Redhat Summit 2015
Application Centric Microservices from Redhat Summit 2015Application Centric Microservices from Redhat Summit 2015
Application Centric Microservices from Redhat Summit 2015
 

Mais de Stuart Lodge

Hot tuna - from Sean Cross
Hot tuna - from Sean CrossHot tuna - from Sean Cross
Hot tuna - from Sean CrossStuart Lodge
 
Helping the Lions Roar
Helping the Lions RoarHelping the Lions Roar
Helping the Lions RoarStuart Lodge
 
Wpug meeting - wp to win8 experiences
Wpug meeting - wp to win8 experiencesWpug meeting - wp to win8 experiences
Wpug meeting - wp to win8 experiencesStuart Lodge
 
AlphaLabs - Node Garden with Speech
AlphaLabs - Node Garden with Speech AlphaLabs - Node Garden with Speech
AlphaLabs - Node Garden with Speech Stuart Lodge
 
About Cirrious ltd
About Cirrious ltdAbout Cirrious ltd
About Cirrious ltdStuart Lodge
 
C# Client to Cloud
C# Client to CloudC# Client to Cloud
C# Client to CloudStuart Lodge
 
How to make a pig udf
How to make a pig udfHow to make a pig udf
How to make a pig udfStuart Lodge
 
C# - Azure, WP7, MonoTouch and Mono for Android (MonoDroid)
C# - Azure, WP7, MonoTouch and Mono for Android (MonoDroid)C# - Azure, WP7, MonoTouch and Mono for Android (MonoDroid)
C# - Azure, WP7, MonoTouch and Mono for Android (MonoDroid)Stuart Lodge
 
Mvvm cross – going portable
Mvvm cross – going portableMvvm cross – going portable
Mvvm cross – going portableStuart Lodge
 
Dev evening - MonoTouch, MonoDroid, Mvvm MvvmCross and databinding
Dev evening - MonoTouch, MonoDroid, Mvvm MvvmCross and databindingDev evening - MonoTouch, MonoDroid, Mvvm MvvmCross and databinding
Dev evening - MonoTouch, MonoDroid, Mvvm MvvmCross and databindingStuart Lodge
 
Wpug mvvm and data binding
Wpug   mvvm and data bindingWpug   mvvm and data binding
Wpug mvvm and data bindingStuart Lodge
 
Ui testing for Windows Phone
Ui testing for Windows PhoneUi testing for Windows Phone
Ui testing for Windows PhoneStuart Lodge
 
Ui Testing on Windows Phone
Ui Testing on Windows PhoneUi Testing on Windows Phone
Ui Testing on Windows PhoneStuart Lodge
 
How To use Map Blogs
How To use Map BlogsHow To use Map Blogs
How To use Map BlogsStuart Lodge
 
Uk Nuke Rpx Authentication For Dot Net Nuke
Uk Nuke Rpx Authentication For Dot Net NukeUk Nuke Rpx Authentication For Dot Net Nuke
Uk Nuke Rpx Authentication For Dot Net NukeStuart Lodge
 
Uk Nuke Facebook Connect Authentication For Dot Net Nuke
Uk Nuke Facebook Connect Authentication For Dot Net NukeUk Nuke Facebook Connect Authentication For Dot Net Nuke
Uk Nuke Facebook Connect Authentication For Dot Net NukeStuart Lodge
 
UkNuke Facebook Connect Authentication For DotNetNuke 5
UkNuke Facebook Connect Authentication For DotNetNuke 5UkNuke Facebook Connect Authentication For DotNetNuke 5
UkNuke Facebook Connect Authentication For DotNetNuke 5Stuart Lodge
 
10 things I’ve learnt In the clouds
10 things I’ve learnt In the clouds10 things I’ve learnt In the clouds
10 things I’ve learnt In the cloudsStuart Lodge
 

Mais de Stuart Lodge (18)

Hot tuna - from Sean Cross
Hot tuna - from Sean CrossHot tuna - from Sean Cross
Hot tuna - from Sean Cross
 
Helping the Lions Roar
Helping the Lions RoarHelping the Lions Roar
Helping the Lions Roar
 
Wpug meeting - wp to win8 experiences
Wpug meeting - wp to win8 experiencesWpug meeting - wp to win8 experiences
Wpug meeting - wp to win8 experiences
 
AlphaLabs - Node Garden with Speech
AlphaLabs - Node Garden with Speech AlphaLabs - Node Garden with Speech
AlphaLabs - Node Garden with Speech
 
About Cirrious ltd
About Cirrious ltdAbout Cirrious ltd
About Cirrious ltd
 
C# Client to Cloud
C# Client to CloudC# Client to Cloud
C# Client to Cloud
 
How to make a pig udf
How to make a pig udfHow to make a pig udf
How to make a pig udf
 
C# - Azure, WP7, MonoTouch and Mono for Android (MonoDroid)
C# - Azure, WP7, MonoTouch and Mono for Android (MonoDroid)C# - Azure, WP7, MonoTouch and Mono for Android (MonoDroid)
C# - Azure, WP7, MonoTouch and Mono for Android (MonoDroid)
 
Mvvm cross – going portable
Mvvm cross – going portableMvvm cross – going portable
Mvvm cross – going portable
 
Dev evening - MonoTouch, MonoDroid, Mvvm MvvmCross and databinding
Dev evening - MonoTouch, MonoDroid, Mvvm MvvmCross and databindingDev evening - MonoTouch, MonoDroid, Mvvm MvvmCross and databinding
Dev evening - MonoTouch, MonoDroid, Mvvm MvvmCross and databinding
 
Wpug mvvm and data binding
Wpug   mvvm and data bindingWpug   mvvm and data binding
Wpug mvvm and data binding
 
Ui testing for Windows Phone
Ui testing for Windows PhoneUi testing for Windows Phone
Ui testing for Windows Phone
 
Ui Testing on Windows Phone
Ui Testing on Windows PhoneUi Testing on Windows Phone
Ui Testing on Windows Phone
 
How To use Map Blogs
How To use Map BlogsHow To use Map Blogs
How To use Map Blogs
 
Uk Nuke Rpx Authentication For Dot Net Nuke
Uk Nuke Rpx Authentication For Dot Net NukeUk Nuke Rpx Authentication For Dot Net Nuke
Uk Nuke Rpx Authentication For Dot Net Nuke
 
Uk Nuke Facebook Connect Authentication For Dot Net Nuke
Uk Nuke Facebook Connect Authentication For Dot Net NukeUk Nuke Facebook Connect Authentication For Dot Net Nuke
Uk Nuke Facebook Connect Authentication For Dot Net Nuke
 
UkNuke Facebook Connect Authentication For DotNetNuke 5
UkNuke Facebook Connect Authentication For DotNetNuke 5UkNuke Facebook Connect Authentication For DotNetNuke 5
UkNuke Facebook Connect Authentication For DotNetNuke 5
 
10 things I’ve learnt In the clouds
10 things I’ve learnt In the clouds10 things I’ve learnt In the clouds
10 things I’ve learnt In the clouds
 

Último

Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Bhuvaneswari Subramani
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdfSandro Moreira
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsNanddeep Nachan
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityWSO2
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelDeepika Singh
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Zilliz
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Angeliki Cooney
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusZilliz
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Victor Rentea
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 

Último (20)

Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 

MvvmCross Introduction

  • 1. MvvmCross Introduction 13th December 2012 @slodge
  • 2. Presentation Model Represent the state and behavior of the presentation independently of the GUI controls used in the interface. http://martinfowler.com/eaaDev/PresentationModel.html
  • 3. In 2005… Model/View/ViewModel is a variation of Model/View/Controller that is tailored for modern UI development platforms where the View is the responsibility of a designer rather than a classic developer. Tales from the Smart Client, John Grossman http://blogs.msdn.com/b/johngossman/archive/2005/10/08/478683.aspx
  • 4. Also in 2005… • 10 years of dev – C++, C, VB, Java, JavaScript, LISP, SmallTalk, Delphi, … • A year off travelling – from Argentina to Zambia • DeveloperDeveloperDeveloper • 1 conclusion:
  • 5. MvvmCross Introduction Evolving the dinosaur 13th December 2012 @slodge
  • 6. What we’ll cover… • MVVM Theory • .Net MVVM • A practical example – some code! • Interface Driven Development – Portable Class Libraries – Unit Testing – Plugins • Some examples
  • 7. What we’ll cover… • MVVM Theory • .Net MVVM • A practical example – some code! • Interface Driven Development – Portable Class Libraries – Unit Testing – Plugins • Some examples
  • 10. What we’ll cover… • MVVM Theory • .Net MVVM • A practical example – some code! • Interface Driven Development – Portable Class Libraries – Unit Testing – Plugins • Some examples
  • 11. ViewModels Public Properties private bool _isSearching; public bool IsSearching { get { return _isSearching; } set { _isSearching = value; RaisePropertyChanged("IsSearching"); } }
  • 12. For ViewModel Changes public interface INotifyPropertyChanged { event PropertyChangedEventHandler PropertyChanged; } public class PropertyChangedEventArgs : EventArgs { public string PropertyName { get; } }
  • 13. For Collections public interface INotifyCollectionChanged { event NotifyCollectionChangedEventHandler CollectionChanged; } public enum NotifyCollectionChangedAction { Add, Remove, Replace, Move, Reset, } public class NotifyCollectionChangedEventArgs : EventArg { public NotifyCollectionChangedAction Action { get; } public IList NewItems { get; } public IList OldItems { get; } public int NewStartingIndex { get; } public int OldStartingIndex { get; } }
  • 14. For Actions public interface ICommand { event EventHandler CanExecuteChanged; bool CanExecute(object parameter); void Execute(object parameter); }
  • 15. .Net Implementation ICommand Public Property Set INotifyPropertyChanged INotifyCollectionChanged Public Property Get
  • 16. Why? To Enable • Awesome UI and Data Development • Unit Testing of code • Large applications to have a common architecture • Different platforms can share code
  • 17. What we’ll cover… • MVVM Theory • .Net MVVM • A practical example – some code! • Interface Driven Development – Portable Class Libraries – Unit Testing – Plugins • Some examples
  • 19. Code evolution I • Single Mono for Android Project • Good separation of UI from ‘Model’ code • Simple – it works • But: – No testing – No testability – Portability by cut/paste
  • 20. Code Evolution 2 • MvvmCross Library switched in – PCL code – Formal DI/IoC used • On UI: – DataBinding arrived – Code got much thinner! – XML got bigger • Not all win: – External Dependencies got larger – Code overall increased in size
  • 21. Code Evolution 3 • Cross Platform • All UIs MVVM • 100% shared application logic • 100% shared test harness
  • 22. Data-Binding WP/WinRT 99% Xaml Droid Mainly Axml Some .Dialog Touch Some .Dialog Some .XIB Some C#
  • 23. What we’ll cover… • MVVM Theory • .Net MVVM • A practical example – some code! • Interface Driven Development – Portable Class Libraries – Unit Testing – Plugins • Some examples
  • 25. Unit Testing “I get paid for code that works, not for tests, so my philosophy is to test as little as possible to reach a given level of confidence. … When coding on a team, I modify my strategy to carefully test code that we, collectively, tend to get wrong.” Kent Beck http://stackoverflow.com/questions/153234/how-deep-are-your-unit-tests
  • 26. Plugin – Native abstractions 1. Declare common functionality (an interface) public interface IMvxComposeEmailTask { void ComposeEmail(string to, string cc, string subject, string body, bool isHtml); } 2. Write platform specific implementations public class MvxComposeEmailTask : MvxWindowsPhoneTask, IMvxComposeEmailTask { public void ComposeEmail(string to, string cc, string subject, string body, bool isHtml) { var task = new EmailComposeTask() { To = to, Subject = subject, Cc = cc, Body = body }; DoWithInvalidOperationProtection(task.Show); } } 3. In apps, use the interface and not the implementation protected void ComposeEmail(string to, string subject, string body) { Cirrious.MvvmCross.Plugins.Email.PluginLoader.Instance.EnsureLoaded(); var task = this.GetService<IMvxComposeEmailTask>(); task.ComposeEmail(to, null, subject, body, false); }
  • 27. Sphero – Plugin Magic • Plugin Magic • Each Plugin: – 1 PCL – 1 Assembly per platform
  • 28. Why? To Enable • Awesome UI and Data Development • Unit Testing of code • Large applications to have a common architecture • Different platforms can share code
  • 29. What we’ll cover… • MVVM Theory • .Net MVVM • A practical example – some code! • Interface Driven Development – Portable Class Libraries – Unit Testing – Plugins • Some examples
  • 31. A team in a galaxy far far away @imaji @mrlacey @sichy @slodge @touch4apps …
  • 42. What we’ve covered… • MVVM Theory • .Net MVVM • A practical example – some code! • Interface Driven Development – Portable Class Libraries – Unit Testing – Plugins • Some examples
  • 43. To join in… If you want to join in: • Tool up • Share • Reuse • Test • Architect
  • 45. Some other talks available http://bit.ly/mvxTweetPic
  • 46. C# - 1 Stack - Cloud to Mobile Data Access Business Logic Presentation Service Consumption Local Data/Services Business Logic UI Logic WP7 iOS Droid Win8
  • 47. Not as cool as dinosaurs Data Access Business Logic Presentation Service Consumption Local Data/Services Business Logic UI Logic WP7 iOS Droid Win8
  • 48. Some credits Images from Wikipedia Commons: • http://en.wikipedia.org/wiki/File:Macronaria_scrubbed_enh.jpg • http://en.wikipedia.org/wiki/File:Human- eoraptor_size_comparison%28v2%29.png Diagrams from Java – ZK • http://books.zkoss.org/wiki/ZK_Developer%27s_Reference/MVVM Sample projects as credited inline
  • 50. Xamarin Seminar Please give us your feedback http://bit.ly/xamfeedback Follow us on Twitter @XamarinHQ 13th December 2012