Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Three's Company - Writing for the Desktop, Browser, and Phone


Published on

Presented to Akron AITP on 5/21/2013

Published in: Technology, Education
  • Be the first to comment

  • Be the first to like this

Three's Company - Writing for the Desktop, Browser, and Phone

  1. 1. Tips & Tricks for Targeting Multiple Platforms with Portable CodePresented by Sarah Dutkiewicz, Cleveland Tech
  2. 2.  Scenarios Tips & tricks for general multiple platform development Overview of Portable Class Library in .NET
  3. 3.  Experiences that cross from one device/platform to another Microsoft Account Office SkyDrive Xbox SmartGlass
  4. 4.  Formerly known as a Windows Live ID Combination of email address and password Unified login for Microsoft tools and other apps that ask for a Microsoft account Xbox LIVE SkyDrive Windows Phone Skype
  5. 5.  Data storage in the cloud Office in the browser – including Word,Excel, PowerPoint, and OneNote Supported platforms include: Windows 8 (built-in) Windows Vista and later Mac OS X Mobile Windows Phone iPhone / iPad Android
  6. 6.  Found for Mac iAnnotate for iPad and Android SoundGecko for iPhone, Android, and Windows Phone Genius Scan+ for iPhone, iPad Remarks for iPad DocScan for iPhone and iPad
  7. 7. How to Develop For Multiple Devices/Platforms
  8. 8.  The better understanding of your audience,the better understanding of which platformsto target. The better understanding of which platformsto target, the better view of what features areavailable as an overall view and platform-specific
  9. 9.  Be sure you understand what it isyou are building and whatplatform(s) you are targeting. Write the code once and reuse it,rather than writing the code inmultiple places and then realizing itcan be isolated into one library.
  10. 10.  Media – images, video Design aspects Models View Models Consumed APIs/RESTful services
  11. 11.  Web & Windows Phone – Perhaps HTML5, Silverlight, or C# Web,Windows Phone, and Windows Store – C# Web & general mobile – consider HTML5
  12. 12.  User Interface Business Logic Data Layer
  13. 13.  Some code is shareable without the portable class library Share the code that would be the same on each platform Typically not the UI Mostly as much business logic as possible Perhaps data layer Portable view models Validation Use design patterns that lend themselves to reusability Model-View-ViewModel (MVVM) Model-View-Controller (MVC) Use third party tools that support cross-platform development
  14. 14.  Appcelerator PhoneGap RhoMobile WidgetPad MoSync
  15. 15.  Visual Studio for targeting Windows MonoGame to help target many platforms: iOS Android Mac OS X Linux Windows 8 Metro Futures include: Windows Phone 8 OUYA (Android-based gaming station) PlayStation Mobile
  16. 16. A look at Portable Class Libraries
  17. 17.  Desktop Web Phone Cloud Xbox Tablets
  18. 18.  .NET 4 and Silverlight 4 Portable Library Tools for Visual Studio2010 Built-in Portable Library support in VisualStudio 2012
  19. 19.  .NET Framework 4, Update 4.0.3 for the.NET Framework 4, and .NET Framework4.5 .NET for Windows store apps Windows Phone 7 and higher (WindowsPhone SDK 8.0 for Windows Phone 8support) Silverlight 4 and 5 Xbox 360
  20. 20.  They must be shared across the target platforms youselected. They must behave similarly across those platforms. They must not be candidates for deprecation. They must make sense in a portable environment,especially when supporting members are notportable. Portable Class Library support appears underVersion Information for a MSDN article
  21. 21.  Include shared business logic and data layer logic in the portable class libraries Use MVVM to write the apps Models and View Models can be shared across platforms and included in portablelibraries Platform-specific views Portable abstractions for non-portable functionality Implement the abstractions for each platform Use IoC or service locator to hook up implementations
  22. 22. • How to display information• Written in XAML, HTML, some other markup language• Platform-specificView• What information to display• Flow of interaction• Can be shared in a portable class libraryView Model• Data objects• Business logic• Can be shared in a portable class libraryModel
  23. 23. PortableClass Library(Models &View Models)WindowsStore App(Views)WindowsPhone App(Views)Silverlight(Views)
  24. 24.  Calling Non-Portable Members from a Portable Class Cannot call the non-portables directly Need to create an abstract class in the Portable Class Library project and use that classfrom all portable code
  25. 25.  HelpDesk Application Metro Style App Windows Phone 7 App Download Source Code
  26. 26.  Store common logic in the portable class library Business logic, but not UI Use abstract classes to work with non-portable code For example, this may be applied to the data layer. Use the MVVM pattern to help minimize code.
  27. 27.  MVVM MVVM Light Toolkit (portable fork) MvvmCross IoC Autofac PortableIoC Ninject (portable fork) Microsoft.Composition Others Json.NET Metrolog Zlib.Portable Portable PRISM
  28. 28.  Write Portable Code Visual Studio Toolbox: Portable Class Libraries Portable Class Libraries Contrib Build 2012: Create Cross-platform Apps using Portable Class Libraries .NET 4.5: David Kean and Mircea Trofin – Portable Libraries Coding4Fun: Portable is as portable does… Maximizing code reuse via the magic of thePortable Class Library Coding4Fun: Digging into your code with the free Microsoft Code Digger and thepower of Pex CodeProject: MonoGame Goes Portable How to Make Portable Class Libraries Work forYou Example: Disentanglement by Daniel Plaisted
  29. 29.  Portable Class Libraries and other portable libraries make it easy to develop formultiple platforms. Know the lay of the land. Know your audience. Know your goals for your app. Keep your commonalities together. Develop accordingly.