SlideShare uma empresa Scribd logo
1 de 39
Cross Platform Mobile
Development in C#
Ross Dargan
@rossdargan
What I’m going to cover
Target 95% of the UK mobile market in C#
With maximum code re-use
What I’m going to cover
What I won’t cover
The other cross platform options
(http://propertycross.com/)
A full walkthrough of the tooling
Blackberry
UK Smartphone Landscape
iOS
27%
Windows
12%
Other
1%
Other
5%
Blackberry
4%

Android
56%

Source: http://bit.ly/19d2thf
Native Development
Android
Java
Eclipse
IntelliJ

Windows Phone
C#/Visual Basic/F#
Visual Studio

iOS
Objective C
Xcode
Xamarin
• C# and .NET for Android, iOS and Mac
• Full native APIs
The bad…
•
•
•
•

Price $2000 per dev per year
Still need a mac
Write once, run (and test!) everywhere
Tooling is still a bit immature (but the
support is great!)
• Need to write each UI separately
UI Considerations
Hello World

DEMO
So… Sharing
File Linking

SHARING CODE
File Linking
File Linking

DEMO
File Linking
Pros
• Quick

Cons
• Messy code
• Progressively more
difficult to maintain as you
add implementations
• Very hard to test
• File linking is a PITA to
remember as you add
files
Portable Class Libraries

SHARING CODE
Adding a PCL
Great… but
Still need platform specific code somehow…
Abstract Classes

SHARING CODE
Multiple Concrete Classes
Abstract Classes

DEMO
Abstract Classes
Pros
• Quick
• Easier to maintain
• Follows Open/Closed
principal

Cons
• Difficult to test
• Pretty inflexible
Dependency Injection

SHARING CODE
Dependency Injection
• Helps separate code (Single responsibility)
• Allows you to unit test’s discrete parts of
the implementation – no God classes
• You can inject in platform specific
implementations
• Inversion of Control allows you to swap
implementations easily
PCL & DI demo

DEMO
Dependency Injection
Pros
• Very loosely coupled
code (reuse)
• Unit tests are easy
• Single Responsibility
• Open/Closed

Cons
•
•
•
What are the downsides to using
Dependency Injection?
It can be dangerous for your career because it
may increase your overall knowledge of good API
design. Once you learn how proper loosely
coupled code can look like, it may turn out that you
will have to decline lots of job offers because you
would otherwise have to work with tightly
coupled legacy apps. Happens to me a lot :)

Source: http://bit.ly/com6aD
Dependency Injection
Pros
• Very loosely coupled
code (reuse)
• Unit tests are easy
• Single Responsibility
• Open/Closed

Cons
• More code
• Bloated constructors
Can we squeeze any more reuse
out?
MVVM

MAXIMIZE UI CODE REUSE
MVVM
Platform Specific Code

Shared Code
Demo
Improving Code Reuse in 3 easy
ways
• Heavy use of dependency injection
– Allows different implementations for different
platforms

• Use PCLs (and file linking for the time
being)
• Use View Models to reuse presentation
code
3 layers of win

MVVMCross
Xamarin
Visual Studio
Links
•
•
•
•
•

http://xamarin.com/
http://mvvmcross.wordpress.com/
http://propertycross.com/
https://github.com/rossdargan/Talks
Dependency Injection in .Net by Mark
Seemann (ISBN: 1-935182-50-1)
• http://www.icndb.com/api/
Questions

Mais conteúdo relacionado

Mais de Waterstons Ltd

Mobile device management and byod – major players
Mobile device management and byod – major playersMobile device management and byod – major players
Mobile device management and byod – major players
Waterstons Ltd
 

Mais de Waterstons Ltd (11)

Preparing for Mobile Device Management & Bring your Own Device
Preparing for Mobile Device Management & Bring your Own DevicePreparing for Mobile Device Management & Bring your Own Device
Preparing for Mobile Device Management & Bring your Own Device
 
Mobile device management and byod – major players
Mobile device management and byod – major playersMobile device management and byod – major players
Mobile device management and byod – major players
 
Mobile device management and BYOD – simple changes, big benefits
Mobile device management and BYOD – simple changes, big benefitsMobile device management and BYOD – simple changes, big benefits
Mobile device management and BYOD – simple changes, big benefits
 
How to Achieve Unified Communications Success
How to Achieve Unified Communications SuccessHow to Achieve Unified Communications Success
How to Achieve Unified Communications Success
 
‘Joining the dots’ of your applications and systems – the benefits of Integra...
‘Joining the dots’ of your applications and systems – the benefits of Integra...‘Joining the dots’ of your applications and systems – the benefits of Integra...
‘Joining the dots’ of your applications and systems – the benefits of Integra...
 
Consumer Experiences for Enterprise
Consumer Experiences for EnterpriseConsumer Experiences for Enterprise
Consumer Experiences for Enterprise
 
Capturing the Real Value of IT Service Management
Capturing the Real Value of IT Service ManagementCapturing the Real Value of IT Service Management
Capturing the Real Value of IT Service Management
 
Mobile for business
Mobile for businessMobile for business
Mobile for business
 
Messaging: Harnessing The Cloud
Messaging: Harnessing The CloudMessaging: Harnessing The Cloud
Messaging: Harnessing The Cloud
 
Messaging:Protecting your Data and your Reputation
Messaging:Protecting your Data and your ReputationMessaging:Protecting your Data and your Reputation
Messaging:Protecting your Data and your Reputation
 
Messaging: Zero Downtime Communications
Messaging:  Zero Downtime CommunicationsMessaging:  Zero Downtime Communications
Messaging: Zero Downtime Communications
 

Último

IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Enterprise Knowledge
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
Earley Information Science
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Último (20)

Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 

Architecting cross-platform applications

Notas do Editor

  1. Ask questions whenever
  2. Show how it connects to the MacShow the android emulatorShow break points
  3. compiler directive
  4. What does any good dev do
  5. Mention who wrote it!!!
  6. Could use MVP