Justin James prepares developers for Windows 8 by explaining what skills and tools are needed to learn to write Metro/WinRT apps.
With the media buzz starting to settle around the Window 8 Developer Preview, it's a good time to determine what tools, skills, and technologies you need to learn to prepare for Windows 8. The good news is all of your development knowledge is transferrable to Windows 8 — if you don't mind the "legacy application" experience. Your Web apps will remain unchanged. It looks like backwards compatibility is maintained, and the upgrades in .NET 4.5 are mostly minor. What will change is the addition of the Metro/WinRT (M/WRT) applications, which represent a significant learning curve. So let's see what you need to learn to write M/WRT applications.
The UI of M/WRT apps is a radical departure from the traditional desktop application. These are some of the differences:
- Sizing and proportions appropriate for touch screens; no areas where precise pointing control is needed.
- More drags, swipes, and flicks; no right-mouse button and no double-clicking/double-tapping if possible.
- Color schemes designed for high-contrast, for use in glare-on-screen, low-light, or on-the-go visibility; bright, bold colors, not subtle shades of greys or pastels. This is not merely aesthetics — it is vitally important for tablet use.
- No multi-windowed interface, no popup windows, no MDI, etc.; instead, a "paging" metaphor is used, where a back button returns users to the previous view.
- Full switch to the MVVM (or at the very least, page + code behind) model.
- Users are much more likely to change system color schemes, and the system color scheme affects your application more deeply.
- Asynchronous operations rule the day.
You have to familiarize yourself with these changes and how they affect your application design, often at the very core. For example, between the shift to asynchronous operations and the lack of popup windows, the way you provide error details to users needs to change quite a bit.
While most of the changes to .NET are relatively minor, the standout item is the support for asynchronous operations. There is the new "await" keyword and the support around it. Then there is the whole Reactive Framework, which flips the event and processing model on its head. These asynchronous systems are the new way forward for M/WRT.
While details about the Windows 8 app store have not been released, I imagine that the restrictions (at least for tablets) will be similar to those for Windows Phone 7 (WP7). And the WP7 App Hub rules say that any long-running operations (meaning, "not instant" for the most part) should happen asynchronously. Indeed, the networking components in WP7 are all asynchronous and notify your application when they are complete. If you are used to putting "Please Wait" on the screen in a modal dialog box, you can forget it. Learn the ins and outs of the asynchronous model and how to adapt it to your needs.
It is getting harder and harder to be a .NET developer without knowing how to use Expression Blend, and that continues to be the case with Windows 8. While Visual Studio's XAML editing capabilities have improved over the years, Expression Blend is where it is at for outstanding visual techniques. Expression Blend seems rather frightening at first if you have never used similar systems like Adobe Flash, but it's really not that tough — it's just a conceptual mountain. Once you understand its key principles, Expression Blend is a tool for you to work in (perhaps with someone more graphically inclined) to give your applications real pizzazz.
The WinRT API
The WinRT API might seem like someone smashed the .NET Framework in the kneecap with a lead pipe — that's how I feel when I work in WP7, and WinRT is very similar to the WP7 SDK. The issue is that so much of what you are used to being able to do is stripped out for reasons pertaining to security, cross-platform compatibility, or style. For example, I cannot find any way to open a file outside of a couple of locations like "Documents" and the local application data store.
While the new asynchronous stuff is neat, you must learn it to do much of anything. Before you commit to a major application, you should spend several days in WinRT doing some of the things you are used to doing, just to get a feel for what does and doesn't work and what you will need to adjust in your style to cooperate with the new model. The thing to keep in mind is the total isolation of the application from the operating system and from other applications.
This is a basic overview of the big changes you will see coming from a traditional WinForms or even a WPF background to the M/WRT model. While it seems daunting at first, most of the technical challenges are pretty easy to learn. The major upheaval is learning to craft UIs that make sense with the new widgets and that will work well on traditional PC form factors as well as tablets and anything else with Windows 8.
J.JaAlso read: How WP7 prepared Microsoft and developers for Windows 8