Portable Class Library: Tomorrows Apps Today                            Jeremy Likness (@JeremyLikness)                   ...
what we do    consulting     training    design     debugging who we are   Founded by top experts on Microsoft – Jeffrey R...
Building Windows 8 Apps with C#                                   • http://bit.ly/win8design                              ...
Agenda •   Introduction to the Portable Class Library •   Understanding Extension SDKs •   Portable profiles •   Chasing I...
Introducing PCL • Write and build managed assemblies that work (without   recompiling) on more than one .NET Framework pla...
Supported Features   Feature             .NET           Windows     Silverlight   Windows   Xbox 360                      ...
PCL in MSDN Documentationconsulting   training   design   debugging   wintellect.com
PCL in MSDN Documentationconsulting   training   design   debugging   wintellect.com
PCL and Model-View-ViewModel • .NET Framework 4.5, .NET for Windows Store apps,   Silverlight, and Windows Phone • Observa...
PCL + VS 2012 = Extension SDK • Software Development Kit (SDK) is a collection of files that Visual   Studio will treat as...
PCL Under the Covers •   Use ILDASM to inspect portable assemblies •   ICommand lives in System.Windows.dll for Silverligh...
PCL Under the Covers (cont.) •   Classic type forwarders route to the appropriate assemblyconsulting   training   design  ...
PCL Under the Covers (cont.) •   Windows Store apps forward to System.ObjectModel and language     projections maps them t...
demo   Basic MVVM with PCLconsulting   training   design   debugging   wintellect.com
Porting Existing Code • Always easier when implementing MVVM, but are your   ViewModels tied to views (i.e. do you include...
Porting Existing Code • You can convert an existing class library to a PCL • First, unload the project • Second, change th...
Strategies for Building New Apps •   Follow S.O.L.I.D. Principles – they do make it easier      –   Single responsibility ...
demo   Wintellog: Windows Store and WPFconsulting   training   design   debugging   wintellect.com
Recap • PCL is native to VS 2012 and uses Extension SDKs • PCL maps target frameworks to profiles that represent a   "lowe...
Questions?                            Jeremy Likness (@JeremyLikness)                            Principal Consultant     ...
Upcoming SlideShare
Loading in …5
×

Wintellect - Devscovery - Portable Class Library

738 views

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
738
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
11
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide
  • var one = 1;one;typeof one;var two = '2',two;typeof two;var three = one + two;three;typeof three; var three = Number(one) + Number(two);typeof three;three;var one = [1,2,3];one;typeof one;var two = ['1', '2', '3']two;typeof two;one[0] == two[0];one[0] === two[0];var three = one + two;typeof three;three;var three = one.concat(two);three;typeof three;
  • var one = 1;one;typeof one;var two = '2',two;typeof two;var three = one + two;three;typeof three; var three = Number(one) + Number(two);typeof three;three;var one = [1,2,3];one;typeof one;var two = ['1', '2', '3']two;typeof two;one[0] == two[0];one[0] === two[0];var three = one + two;typeof three;three;var three = one.concat(two);three;typeof three;
  • var one = 1;one;typeof one;var two = '2',two;typeof two;var three = one + two;three;typeof three; var three = Number(one) + Number(two);typeof three;three;var one = [1,2,3];one;typeof one;var two = ['1', '2', '3']two;typeof two;one[0] == two[0];one[0] === two[0];var three = one + two;typeof three;three;var three = one.concat(two);three;typeof three;
  • var one = 1;one;typeof one;var two = '2',two;typeof two;var three = one + two;three;typeof three; var three = Number(one) + Number(two);typeof three;three;var one = [1,2,3];one;typeof one;var two = ['1', '2', '3']two;typeof two;one[0] == two[0];one[0] === two[0];var three = one + two;typeof three;three;var three = one.concat(two);three;typeof three;
  • Show the original first. Run in IE8 and IE9, then show crash in IE7 – find out if students can even see where the crash is coming from.Run JSLint, note it stops after a short time and you have to keep making fixes to keep it moving. Note complaints about spaces. Show that the defect was addressed.Now configure JSHint and show that experience.
  • Show the original first. Run in IE8 and IE9, then show crash in IE7 – find out if students can even see where the crash is coming from.Run JSLint, note it stops after a short time and you have to keep making fixes to keep it moving. Note complaints about spaces. Show that the defect was addressed.Now configure JSHint and show that experience.
  • Wintellect - Devscovery - Portable Class Library

    1. 1. Portable Class Library: Tomorrows Apps Today Jeremy Likness (@JeremyLikness) Principal Consultant jlikness@wintellect.com Copyright © 2012consulting training design debugging wintellect.com
    2. 2. what we do consulting training design debugging who we are Founded by top experts on Microsoft – Jeffrey Richter, Jeff Prosise, and John Robbins – we pull out all the stops to help our customers achieve their goals through advanced software-based consulting and training solutions. how we do it Training • On-site instructor-led training Consulting & Debugging • Virtual instructor-led training • Architecture, analysis, and design services • Devscovery conferences • Full lifecycle custom software development • Content creation Design • Project management • User Experience Design • Debugging & performance tuning • Visual & Content Design • Video & Animation Productionconsulting training design debugging wintellect.com
    3. 3. Building Windows 8 Apps with C# • http://bit.ly/win8design • Free source at: http://windows8applications.codeplex.com/ • Everything you need to build and deploy Windows Store apps using C# and XAML • Includes the portable project you will see todayconsulting training design debugging wintellect.com
    4. 4. Agenda • Introduction to the Portable Class Library • Understanding Extension SDKs • Portable profiles • Chasing ICommand: PCL Under the Hood • Porting existing code • Strategies for building new applications • Comprehensive Example: Wintellog • PCL Futuresconsulting training design debugging wintellect.com
    5. 5. Introducing PCL • Write and build managed assemblies that work (without recompiling) on more than one .NET Framework platform • Target frameworks include: – .NET Framework 4 and later (including WPF) – .NET for Windows Store apps (Windows 8) – Silverlight 4 and later – Windows Phone 7 and later – Xbox 360 • Eliminate sharing of sourceconsulting training design debugging wintellect.com
    6. 6. Supported Features Feature .NET Windows Silverlight Windows Xbox 360 Framework Store Phone Core Yes Yes Yes Yes Yes XLINQ 4.0.3+ Yes Yes Yes Yes LINQ Yes Yes Yes Yes Network Yes Yes Yes Yes Serialization Yes Yes Yes Yes WCF Yes Yes Yes Yes IQueryable Yes Yes Yes 7.5+ MVVM 4.5 Yes Yes Yes MEF Yes Yes Yes Numerics Yes Yes Yes Dynamic 4.5 Yes Yes Annotations 4.0.3+ Yes Yesconsulting training design debugging wintellect.com
    7. 7. PCL in MSDN Documentationconsulting training design debugging wintellect.com
    8. 8. PCL in MSDN Documentationconsulting training design debugging wintellect.com
    9. 9. PCL and Model-View-ViewModel • .NET Framework 4.5, .NET for Windows Store apps, Silverlight, and Windows Phone • Observable collections (normal and read-only) • Notify property changed • Notify collection changed • Notify data error info • ICommandconsulting training design debugging wintellect.com
    10. 10. PCL + VS 2012 = Extension SDK • Software Development Kit (SDK) is a collection of files that Visual Studio will treat as a single item – Platform SDK – mandatory for a target platform, i.e. "Windows 8 SDK" – Extension SDK – optional components to extend a platform • Target Platform Moniker (TPM) = Identifier (TPI) and Version (TPV) ex: "Windows, version=8.0" • References (binaries, either .WinMD or assemblies), redistributables, and design-time components • Can drop any components to a path with a TPM and Visual Studio will substitute that path • Easy to see what the target profile is • Each combination of target platforms creates a unique profileconsulting training design debugging wintellect.com
    11. 11. PCL Under the Covers • Use ILDASM to inspect portable assemblies • ICommand lives in System.Windows.dll for Silverlight, but System.dll in .NET 4.5 and Windows.UI.Xaml.Input.dll in Windows Store apps ("retargetable")consulting training design debugging wintellect.com
    12. 12. PCL Under the Covers (cont.) • Classic type forwarders route to the appropriate assemblyconsulting training design debugging wintellect.com
    13. 13. PCL Under the Covers (cont.) • Windows Store apps forward to System.ObjectModel and language projections maps them to the WinRT frameworkconsulting training design debugging wintellect.com
    14. 14. demo Basic MVVM with PCLconsulting training design debugging wintellect.com
    15. 15. Porting Existing Code • Always easier when implementing MVVM, but are your ViewModels tied to views (i.e. do you include XAML namespaces?) • Decoupled code is key • Identify key APIs that are platform-specific and implement façade • Common areas to refactor out include UI, networking, and storage • Convert an existing class library to a PCL assemblyconsulting training design debugging wintellect.com
    16. 16. Porting Existing Code • You can convert an existing class library to a PCL • First, unload the project • Second, change the settings: <Import Project="$(MSBuildToolsPath)Microsoft.CSharp.targets" /> to <Import Project="$(MSBuildExtensionsPath32)MicrosoftPortable$(Target FrameworkVersion)Microsoft.Portable.CSharp.targets" /> • Next, add the following project GUIDs to the end of the first property group – this adds the library tab and dialog to change the targets: <ProjectTypeGuids>{786C830F-07A1-408B-BD7F- 6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B- 00C04F79EFBC}</ProjectTypeGuids> • Finally, reload the project and select the target frameworksconsulting training design debugging wintellect.com
    17. 17. Strategies for Building New Apps • Follow S.O.L.I.D. Principles – they do make it easier – Single responsibility – a class should only do one thing and change for one reason – Open/closed principle – open for extension, closed for modification – Liskov substitution principle – no side effects/unexpected behaviors when cast to a base class – Interface segregation – interfaces should be focused on specific, targeted functionality – Dependency Injection – keep dependencies external from your class and inject them • Use MVVM and keep view-specific code in the view, not the view model • Target the smallest number of frameworks possible in your portable assemblies to ensure the widest surface area of APIs to choose from, i.e. dont include Xbox if youre not going to write for it • Pick a target platform to run your unit tests and only write tests for PCL assemblies in that target • Dont forget to write unit tests for the classes that are specific to target platformsconsulting training design debugging wintellect.com
    18. 18. demo Wintellog: Windows Store and WPFconsulting training design debugging wintellect.com
    19. 19. Recap • PCL is native to VS 2012 and uses Extension SDKs • PCL maps target frameworks to profiles that represent a "lowest common denominator" of API surface area • Under the hood, PCL takes advantage of type forwarders and Windows 8 advances to enable the portable assembly • Existing code can be ported to use the PCL • New applications should take advantage of the PCL for various core assemblies, with storage and UI abstracted away • PCL should be a solid investment as the team is actively working on updates to keep pace with the latestconsulting training design debugging wintellect.com
    20. 20. Questions? Jeremy Likness (@JeremyLikness) Principal Consultant jlikness@wintellect.comconsulting training design debugging wintellect.com

    ×