• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Metro-style Apps for .NET Developers
 

Metro-style Apps for .NET Developers

on

  • 3,060 views

Take a look at how Metro-style apps are likely to impact the work of .NET developers, and what new opportunities may be realized. Comments? @mbrit on Twitter.

Take a look at how Metro-style apps are likely to impact the work of .NET developers, and what new opportunities may be realized. Comments? @mbrit on Twitter.

Statistics

Views

Total Views
3,060
Views on SlideShare
3,059
Embed Views
1

Actions

Likes
3
Downloads
0
Comments
0

1 Embed 1

http://localhost 1

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

CC Attribution-ShareAlike LicenseCC Attribution-ShareAlike License

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment
  • Thing about the battle on two fronts
  • An example of where you can do the same things in a different way
  • SQLite can throw up BUSY errors, however.
  • 90% of software is built for private use

Metro-style Apps for .NET Developers Metro-style Apps for .NET Developers Presentation Transcript

  • Metro-style Apps for .NET Developers Matthew Baxter-Reynolds July 2012 – v1 (Public) http://programmingmetrostyle.com/Presentation licensed under the Creative Commons Attribution-ShareAlike license, see last slide
  • Agenda • Reimaging Windows • The Mechanics of Metro-style • What can you do today? • Q&ATwitter: @mbrit 2
  • Hire me • Like this presentation? – Private, onsite presentations of Metro-style app workshops tailored to your development programme – In-depth Metro-style training (public or private courses) – Consultancy on your Metro-style development plans – http://mbrit.com/Twitter: @mbrit 3
  • Reimagining WindowsTwitter: @mbrit 4
  • Reimagining Windows • Windows 8 is as big a deal as Windows 95 – A break from the past – A way to lock in revenue for the next 20 years – It looks wacky now – wait five yearsTwitter: @mbrit 5
  • Deprecating WIMP • Windows 8 is about moving past WIMP – Windows, Icons, Menus, and Pointers – If you’ve only got a finger, lots of things don’t make sense…  WS_POPUP windows  Menus  Combo boxes  Notification area  Right-clicking  etc.Twitter: @mbrit 6
  • Metro-style on the Desktop • It sort of doesn’t make sense… – Try it on a tablet – …then remember you’re getting rid of WIMP – …then it’ll make senseTwitter: @mbrit 7
  • The Land of Confusing Naming • Metro is the name of a “design aesthetic” – Created for Windows Phone – Embraced vigorously by Microsoft • WinRT is the name of a new API for Windows – Replaces Win32 • WOA was the name for “Windows on ARM” – A version of Windows that run on ARM processors • Windows RT is the name given to new ARM- based devicesTwitter: @mbrit 8
  • The Land of Consuming Naming (2) • Metro-style is the name of the process model and related deployment technologies used for a new class of applications – …specifically designed to address a post-PC ageTwitter: @mbrit 9
  • WinRT defined • “Windows Runtime” • An old strategy – older than iPad – The fact it’s happening now is coincidence • Pressures? – Building Windows, Office, SQL Server, etc is hard in Win32 – WinRT was designed to address this problem • It’s COM! – …or as I like to call it, “COM++”Twitter: @mbrit 10
  • Post-PC • Post-PC prompts the re-imagining of Windows – First class of computing use that hasn’t been centred around work  They are centred around relationships – Tablets aren’t post-PC, but post-PC is (in today’s technology) usually a tablet – Smartphones and tablets are conflated  Which is a mistake – “Consumption only” is a fallacy – iPad is a “version one” device  Shows us you can ditch WIMP and the file systemTwitter: @mbrit 11
  • Post-PC (2) • Features – No keyboard – Touch-centric – Always on Internet connection  i.e. cellular data – No intimidation – Full trustTwitter: @mbrit 12
  • Surface • Love it! – Probably used to more clearly inform OEMs what the objective was – OEMs still needed as market is too big for one company to supply it – This is a “version 2” post-PC device – It’s got a keyboard!  …because you can’t sell Office without oneTwitter: @mbrit 13
  • The challenge of post-PC • They’re not about work… – So if you build software for business, it’s a bit of a hard sell… – The challenge is whether Microsoft’s post-PC tablet is actually a “PCablet”, or similar…?Twitter: @mbrit 14
  • What’s Metro-style for? (Retail) • In the retail space, it’s for what the iPad is for… – Typical Top 100 paid iPad apps  80% games  19% non-games, but not “work” (Instagram, etc)  1% work (nearly always Documents-to-Go) – Similar split on iPhone, Android phones, and Windows PhoneTwitter: @mbrit 15
  • What’s Metro-style for? (Enterprise) • So how are people using iPad in business? – Groupware  Email, calendar, contacts – Web browsing – Document viewing – Some document construction – Navigation  e.g. off the tube, where’s the meetingTwitter: @mbrit 16
  • The iPad and native LOB • Apple offers an iOS Developer Enterprise Program… – “Distribute your proprietary, in-house iOS apps to employees or members of your organisation” – $299/year – But unusual…  Do you know of anyone who does it?  Why’s it unusual?Twitter: @mbrit 17
  • Metro-style LOB apps • Microsoft knows corporates… – Expect Microsoft to put some effort into marketing tablets – Expect to be inundated with tablet marketing from MCPs and the channelTwitter: @mbrit 18
  • The Android Disaster Zone • Nexus 7 is a media tablet – You’ll never see one in business – Hugo Barra at Google I/O:  "Create an experience that is optimized around all this great content that is available in Google Play".  "We wanted a device that lets you immerse yourself in all of that media”  "We wanted you to be delighted when you read books and magazines, watch movies, and play games.” – Some semi-industrial use is workableTwitter: @mbrit 19
  • How this will (probably) fall out • Apple/iPad – Will own an end-to-end content ecosystem – Focused on consumers – BYOD • Microsoft/Surface – Will owns the business market – Enterprise-supplied devices • Android – Tablets: Nowhere – Phones: Niche  Don’t underestimate the halo effectTwitter: @mbrit 20
  • What about Silverlight? • Generally… – There are some legitimate uses for Silverlight within the enterprise  Visualisation very common • Inside the enterprise – It’s unclear whether Metro-style replaces apps that run in Silverlight in the enterprise…  There’s lots of bits missing in this new world  Will the context switching between Metro-style and regular desktop kill usability?Twitter: @mbrit 21
  • Touch on laptops • Whitepaper – “The Human Touch: Building Ultrabook Applications in a Post-PC Age” – Lack of touch on new MacBook Pro is a misstepTwitter: @mbrit 22
  • Windows Phone • Windows Phone 7 – Currently based on a Silverlight subset • Windows Phone 8 – Indicated the OS core will be Windows 8 – No clarity on whether/when the API is moving to WinRT/Metro-style  …although it almost certainly willTwitter: @mbrit 23
  • Searching for “winrt” on Google • Google interprets “winrt” as “winter”, so just exclude out “winter”… contracts winrt -winterTwitter: @mbrit 24
  • Getting to Release • Nothing set in stone… – “Release to Manufacturing” in late July – “General availability” in October – “Windows RT” devices this year – “Windows 8” tablets next year  (We need the chipsets!)Twitter: @mbrit 25
  • The Mechanics of Metro-styleTwitter: @mbrit 26
  • Dealing with constriction • You’re going to feel like you’ve had your wings clipped… – Metro-style is not the place for clever hackery – You’ve got no battery, no bandwidth, no mouse – You’ve got to retain trust – Ride the wave!Twitter: @mbrit 27
  • Choosing a UI track – HTML or XAML • Individually and as a community, this is an important choice… – My personal view right now is XAML – Is the tooling going to be good enough? – Where will community support go? – Is the current interop story workable? – Where do we want to be in 2018?Twitter: @mbrit 28
  • What you don’t get • Lots! • Major sections are… – No ADO.NET – No serialization – No Remoting – No System.Reflection.Emit – No threading outside of Task Parallel LibraryTwitter: @mbrit 29
  • What’s changed? • Some APIs are now asynchronous… • Some .NET types have been moved to WinRT components… – …of which XAML is a good example • Some types/members are gone! – …either replaced by WinRT (e.g. storage APIs) – …or restructured wholesale  System.Reflection is a (baffling) exampleTwitter: @mbrit 30
  • The Open Source problem • A significant problem with developing Metro- style is the lack of OSS libraries… – The ecosystem is missing Castle Core SQLite sqlite-net xUnit ESENT Moq NInject NLog Lucene Interop Raven Newtonsoft Raven Client JSON EmbeddedTwitter: @mbrit 31
  • Open Source libraries resist porting • Most actively used OSS libraries are cross platform already… – Silverlight, Compact Framework, Mono, etc – But anything other than trivial projects end up being hard work…  Individually you’re unlikely to want to carry the cost  As a community, these libraries are going to take a while to come over  10 months since BUILDTwitter: @mbrit 32
  • Look to prefer “Silverlight libraries” • .NET Core is closer to Silverlight than .NET Full… – …you’ll probably have more luck using Silverlight versions of libraries as these are already cut-down to something closer to .NET CoreTwitter: @mbrit 33
  • Enterprise Features • You’re going to need these to build LOB… – One code base, many targets – Databases – Background syncing – Web services – Unit testing – PackagingTwitter: @mbrit 34
  • Enterprise Features • You’re going to need these to build LOB… – One code base, many targets – Databases – Background syncing – Web services – Unit testing – PackagingTwitter: @mbrit 35
  • Multiplatform targeting • You need one codebase that works in .NET and WinRT… – Let’s look at howTwitter: @mbrit 36
  • Changes to “System.Reflection” • Good example of an established API that has changed – Basic properties have moved out into a separate Extension method to System.Reflection.TypeInfo class access metadata – Mostly everything is available through extension methods …oddly offering less utility!Twitter: @mbrit 37
  • Shimming with extension methods • One significant challenge is creating one code base that works in .NET Full and .NET Core – Extension methods are your friend – Type aliasing is also your friend – #if…#endif is your other, other friend – Look to Silverlight ports in open source projects for helpTwitter: @mbrit 38
  • Shimming - Example Our Reflection shim Extension properties don’t exist Closer to the .NET original, but not quite right because of that “IsPublic” method…Twitter: @mbrit 39
  • Reverse shimming with extension methods • We need to get parity between .NET and Metro-style… A “reverse shim” that makes the .NET API look like the Metro-style API In a real implementation, the namespaces would be the sameTwitter: @mbrit 40
  • Type aliasing with “using” This has the effect of replacing the type at The original .NET compile-time implementation Unchanged underlying implementation Assuming “Bar” is unavailable in Metro-style, create a copy…Twitter: @mbrit 41
  • “#if…#endif” • Use this to compile around code that’s not supported, or to switch implementations – The preprocessor directive for Metro-style apps is NETFX_CORE – Pick the primary path and be consistentTwitter: @mbrit 42
  • Solution structure • Keep solutions and projects separate and use symbolic links – Wherever possible do not duplicate code filesTwitter: @mbrit 43
  • Enterprise Features • You’re going to need these to build LOB… – One code base, many targets – Databases – Background syncing – Web services – Unit testing – PackagingTwitter: @mbrit 44
  • Databases • For most platforms, this story is pretty good: – iOS – baked in SQLite, native driver or Core Data – Android – baked in SQLite, native driver – BlackBerry – baked in SQLite, native driver • Windows Phone and Metro-style? – *crickets* – SQLite supported by SQLite.org and “sqlite-net” OSS project – Sandboxing makes SQL Server impossibleTwitter: @mbrit 45
  • Enterprise Features • You’re going to need these to build LOB… – One code base, many targets – Databases – Background syncing – Web services – Unit testing – PackagingTwitter: @mbrit 46
  • Battery • “If it’s not running, it’s not using the battery” – …therein lies everything you need to know about application lifetime in Metro-styleTwitter: @mbrit 47
  • Micro-hibernation • Even on a mains powered desktop, apps that are in the background are spun to diskTwitter: @mbrit 48
  • Apps that sync in the background • You probably can’t sell a sponsor on an app that requires “always on” internet… – Background tasks let you to this – Has to be light…  Docs specifically call out “SETI@home” as an example of something you shouldn’t doTwitter: @mbrit 49
  • Background tasks • Register a class along with one trigger and optional conditions… – Plus a manifest declaration Triggers Conditions/System trigger types InternetAvailable InternetNotAvailable ControlChannelTrigger LockScreenApplicationAdded LockScreenApplicationRemoved MaintenanceTrigger NetworkNotificationChannelReset OnlineIdConnectedStateChanged PushNotificationTrigger ServicingComplete SessionConnected SessionDisconnected SessionStart TimeTrigger SmsReceived TimeZoneChange SystemTrigger UserAway UserPresentTwitter: @mbrit 50
  • Background tasks (2) 15 minutes is the highest frequency that you can haveTwitter: @mbrit 51
  • Background tasks (3) • You don’t necessarily run inside your own application’s process… – PushNotificationTrigger and ControlChannelTrigger do… – The others do not • Resources are constrained/metered – Remember the battery!Twitter: @mbrit 52
  • Background tasks (4) • Some triggers are restricted to apps on the lock screen… – MaintenanceTrigger is not  …but only runs when on AC power – TimeTrigger is  …as is PushNotificationTrigger and ControlChannelTriggerTwitter: @mbrit 53
  • Using background tasks for background sync • Steps… – Keep track of changes to local state as you normally would – If the app is in the foreground…  Use TPL to schedule  Do time-critical stuff in situ – If the app is suspended/terminated…  Use a combination of TimeTrigger and SystemChangeTrigger to run every “n” minutes, plus when internet access resumes – Bonus points: Cached File Updater ContractTwitter: @mbrit 54
  • Using background tasks to sync… cheat mode • To get through the store, you’re not allowed to depend on third-party services… – But you could write a service that processes your SQLite database and syncs changesTwitter: @mbrit 55
  • Enterprise Features • You’re going to need these to build LOB… – One code base, many targets – Databases – Background syncing – Web services – Unit testing – PackagingTwitter: @mbrit 56
  • Web services • The expectation is that apps are live and sucking down data from WCF.. – That’s a naïve view • Old school SOAP web services are not supportedTwitter: @mbrit 57
  • Enterprise Features • You’re going to need these to build LOB… – One code base, many targets – Databases – Background syncing – Web services – Unit testing – PackagingTwitter: @mbrit 58
  • Unit testing • The only game in town is the Visual Studio test runner… – Has to run as an actual Metro-style app to setup the app container – xUnit support is coming  …likely to be the only one outside of VSTwitter: @mbrit 59
  • Enterprise Features • You’re going to need these to build LOB… – One code base, many targets – Databases – Background syncing – Web services – Unit testing – PackagingTwitter: @mbrit 60
  • Enterprise deployment scenarios • Four scenarios to consider… – Windows 8 ESD (Enterprise Supplied Device) – Windows 8 BYOD – Windows RT ESD – Windows RT BYODTwitter: @mbrit 61
  • Enterprise apps and the Store • Enterprises can deliver their applications through the store… – Clever model for handling licensing provided by Microsoft – …but an unlikely scenario for LOBTwitter: @mbrit 62
  • Sideloading • This is the process by which applications are loaded onto the device outside of the store – Enterprise deployment is all about enabling “sideloading”Twitter: @mbrit 63
  • Sideloading – Restrictions apply • Sideloading means you don’t have to pass the store requirements… – What’s impossible remains impossible  Still can’t SRE, sleep threads, work outside of sandbox, etc – Reminder: on Windows RT, there’s no sideloadingTwitter: @mbrit 64
  • Windows 8 ESD • It’s assumed in this scenario that the device is joined to the domain… – Possibly only works in Windows 8 Enterprise – This enables a group policy item – Sign the app – Optionally validate the app through the Store Certification Kit  (There are many reasons why you wouldn’t want to do this, however…) – Then deploy…Twitter: @mbrit 65
  • Windows 8 BYOD • Here, we assume a BYOD scenario is one where there is no domain membership – Change Registry to enable sideloading – Activate a “special product key”  Information on this is pending – Sign the app – Optionally validate the app – Then deploy…Twitter: @mbrit 66
  • Windows RT – ESD and BYOD • Picture remains unclear… – Was discussed at TechEd – This definitely needs to get through the WACK – Will almost certainly be some sort of centrally managed portalTwitter: @mbrit 67
  • Installing apps • Two methods… – Bake it into the image – Deploy using PowerShellTwitter: @mbrit 68
  • PowerShell installation • This is the advantage of having everything wrapped up into a single AppX file… – add-appxpackage fooserverappsmyapp.appx  (You can script dependencies too) – Script in the usual way! • The same add-appxpackage command will also run updates – …thus just deploy a new file, updates go out automaticallyTwitter: @mbrit 69
  • Removing apps • Again, having everything wrapped up nicely in packages helps here… – remove-appxpackageTwitter: @mbrit 70
  • What You Can Do TodayTwitter: @mbrit 71
  • Selling Metro-style • You’re unlikely to sell your boss on a production project – …although it’s likely to come up in conversation • You probably can kill pending iPad projects… – …if that’s helps you! • Where can you take your strategy/plans?Twitter: @mbrit 72
  • Moving forward • Aspects… – Unit testing – Web apps – Phone apps – Windows Forms – SilverlightTwitter: @mbrit 73
  • Moving forward • Aspects… – Unit testing – Web apps – Phone apps – Windows Forms – SilverlightTwitter: @mbrit 74
  • Unit testing • Think carefully about your unit testing strategy if you have a shared codebase… – The only safe option is the Visual Studio test framework – A probably safe second option is xUnit  Everything else requires shimming – Mocking remains impossible • ACTIONS – Move over, or deprecate use, of a potentially unsupported framework – Don’t mockTwitter: @mbrit 75
  • Moving forward • Aspects… – Unit testing – Web apps – Phone apps – Windows Forms – SilverlightTwitter: @mbrit 76
  • ASP.NET • For clarity, nothing about Metro-style/WinRT changes the ASP.NET story… – As you were!Twitter: @mbrit 77
  • Designing web for touch • It’s going to go this way – you might as well get used to it… – This is probably the only guarantee in all this – Use common sense – if you’re having to pinch in to hit a target, the target is too small – For the most part you can adapt with CSS – Some controls won’t translate • ACTIONS – Develop touch-centric and adaptive prototypes – Try and sell a pilot programmeTwitter: @mbrit 78
  • jQuery Mobile • Designed for mobile… – But a good demonstration of the principles on a tablet • ACTION – Experiment with this frameworkTwitter: @mbrit 79
  • Moving forward • Aspects… – Unit testing – Web apps – Phone apps – Windows Forms – SilverlightTwitter: @mbrit 80
  • Phone apps • Lots of options! – …although a bit tangential – Easy to sell – Good way of getting your/your boss’s feet wet – Consider…  PhoneGap – improves web development skills  Xamarin – C# based development on iPhone and Android  Windows Phone native – perhaps? • ACTIONS – Sell small scale pilot projectsTwitter: @mbrit 81
  • Moving forward • Aspects… – Unit testing – Web apps – Phone apps – Windows Forms – SilverlightTwitter: @mbrit 82
  • Windows Forms • Two types of apps… – Trivial, utility apps – Massive enterprise apps • Windows Forms is likely to be supported “forever”… – Microsoft is an enterprise company after all – Obviously won’t run on Windows RT • ACTIONS – Nothing obvious…?Twitter: @mbrit 83
  • Moving forward • Aspects… – Unit testing – Web apps – Phone apps – Windows Forms – SilverlightTwitter: @mbrit 84
  • Silverlight • Silverlight is not likely to be supported forever… – Really unclear where to go with that – Having Silverlight and Metro-style in the market is too confusing • ACTIONS – What do you think? Twitter: @mbrit 85
  • Hire me • Like this presentation? – Private, onsite presentations of Metro-style app workshops tailored to your development programme – In-depth Metro-style training (public or private courses) – Consultancy on your Metro-style development plans – http://mbrit.com/Twitter: @mbrit 86
  • Q&A Matthew Baxter-Reynolds Independent software development consultant, speaker, author and trainer http://mbrit.com/ @mbritLicenseThis presentation is licensed for use under the “Creative CommonsAttribution-ShareAlike 3.0 Unported” license:http://creativecommons.org/licenses/by-sa/3.0/IconsIdea icon: The Noun ProjectBeaker icon: The Noun ProjectFloppy disk icon: Mike Wirth, from The Noun ProjectAperture icon: P.J. Onori, from The Noun ProjectBarking dog icon: The Noun ProjectApprove icon: from The Noun ProjectTwitter: @mbrit 87