WinRT is your friend

Microsoft’s BUILD conference of 2011 is over, but the shockwave it unleashed has barely even begun to materialize yet. The developer world is still scrambling to make sense out of what just happened. What they debuted at BUILD marks the end of one era, and the beginning of a new one. Good old Win32, that layer of abstraction between the Windows kernel and your desktop applications, which first shipped with Windows NT in 1993, is no longer the only way to build Windows apps. Windows 8 will ship with another layer of abstraction between the Windows kernel and your apps (technically, your “Metro” style apps) called the Windows Run Time, also known as WinRT. Windows 8 will support both Win32 and WinRT apps.

“So what?” you might be thinking. When stated as a technical detail, the inclusion of WinRT as part of Windows 8 might seem like a mundane matter not worth much attention. However, this seemingly minor detail represents a significant change in the Windows operating system, and in Microsoft’s business direction and vision of itself. WinRT was designed to support a whole new style of software application and human interaction model. It was built so that the operating system can run on x86 and x64 processors, like in your desktop or laptop, but also it supports running on the ARM processors used in mobile devices.

The user interface seen in the Developer Preview of Windows 8, released at BUILD, is a combination of Windows 7 and something totally new for Windows, often referred to as the “Metro” style.

The standard/classic Windows desktop that we all are accustomed to is still available, powered by good old Win32, but it is not what shows up on your monitor when you first boot Windows. When you first boot up, the WinRT-powered Metro screen fills your monitor(s). For me, at this early stage in trying out an early build of Windows 8, it feels like Windows has developed a multiple personality disorder. It can’t decide if it is an office worker or a high school kid. Then again, having this dual modality is not necessarily a bad thing, considering how most people use computers for work and entertainment in their lives, which are very different ways to use a computing device. I guess if Microsoft wants to remain relevant in a world increasingly dominated by iPads, this makes sense.

There are tons of fascinating technical details about WinRT that I’d love to dive into, such as how it was written in C++ but is “projected” into three separate stacks (XAML + C#/VB.NET, HTML5+JavaScript, XAML + C++), how it supports a subset of the .NET 4.5 framework, the fact that any method expected to take at least 50 milliseconds to complete was implemented async, and so much more. But there’s plenty of time to get into that, and other bloggers have already touched on a lot of the good bits. What I’m really happy to see in WinRT is the fact that it seems to be very, very heavily influenced by WPF and Silverlight. In fact, at BUILD one of the demos was converting a Silverlight project to WinRT just by changing a few namespaces and adding the occasional #if. Most of the skills that WPF and Silverlight devs have acquired over the years will be relevant and useful in the years ahead, hence the title of this blog post.

Many people have asked me why I decided to get into iOS development. The answer is, mostly, because as a Windows developer I felt that the world was passing me by. Things felt stagnant in the Microsoft world, while exciting advancements were happening all around in other technologies, especially the stuff coming out of Apple. Couple that with an unquenchable hunger to learn, and it only made sense to move on to greener pastures. But it looks like Microsoft might actually have something here, with WinRT. Only time will tell, but it’s exciting to see them try something bold and new (for them).

Thus far my experience with WinRT programming, which is obviously sparse considering the first preview build was just released, feels a hell of a lot like WPF or Silverlight programming. Windows itself basically has the next generation of WPF/SL built in, so to speak, and that is unspeakably exciting for me!

Some folks at Microsoft published this list of hardware that they use to run Windows 8 on touch-enabled systems. I read that list, did some research, then went out and invested in the ASUS EP121 slate. Now my WinRT dev rig looks like this:

That’s right, a tiny little slate computer is powerful enough to run the latest version of Windows, Visual Studio 11, supports multi-touch input, a keyboard, a mouse, and a 27″ external monitor…all at lightning speed. I am just amazed.

To install the operating system I needed to download the Developer Preview (which comes with Visual Studio Express pre-installed) and then followed the steps on Scott Hanselman’s blog post that shows how to put the ISO file onto a 16 GB USB thumb drive so that I could boot from that on my slate. I didn’t bother installing it to a VHD, as Hanselman explains, because I have a dedicated machine just for Windows 8, but it seems like many people are having success with virtualizing Win8 on their machines.

Regardless of whether Windows 8 might be a success or not, I think it is something that should be investigated. It’s too significant to ignore.

25 Responses to WinRT is your friend

  1. Karl says:

    Got to love Windows development. JJ, awesome setup!

    kdawg

  2. ross says:

    I am pretty happy with what they have done with WinRT, particularly given what some bloggers (with a grudge) were predicting. Nice to see XAML still in there.

    The only thing I found a little disturbing is that according to some reports WinRT apps running on ARM based machines can only be written in JS/HTML. I’m not sure if this is true.

  3. Josh Smith says:

    Ross,

    I believe MSFT stated that ARM based machines will only be able to run WinRT, not Win32. To my knowledge, they did not state that Metro apps for ARM machines can only be written in HTML5/JS. The fact that WinRT is projected into three stacks, one of which happens be HTML based, indicates that the runtime is stack-agnostic.

    Josh

  4. Jordan says:

    Awesome set up Josh! It’s lie it’s 2002 all over again!

  5. Nice post Josh. Very exciting times indeed!

  6. Nish says:

    Josh,

    I checked prices for the ASUS EP121 slate on Amaazon and they seem to go for 1300-1500 there. That seems incredibly over-priced for a tablet to me. Did you pay a similar price for yours?

    Nish

  7. Josh Smith says:

    Nish,
    I paid $1099 for mine.
    Josh

  8. Nish says:

    Not bad, but still expensive for a tablet. Thanks Josh.

  9. David Nelson says:

    “Windows 8 will ship with another layer of abstraction between the Windows kernel and your apps (technically, your “Metro” style apps) called the Windows Run Time, also known as WinRT.”

    Not sure why you chose to minimize the Metro-only restriction with “technically”, as in my opinion that basically makes WinRT worthless. Some of the concepts of Metro apps are great – package-based install/uninstall, application isolation, process sandboxing, and forced declaration and user approval for usage of system devices. These are all things that have been desperately needed in the Windows environment for a long time to combat the stability and security problems that Windows is known for more than anything else.

    But the other restrictions of Metro – can only be installed from the Windows store, must run full-screen, single instance, and heuristic-based shutdown instead of user control – any one of these would be a deal breaker, and together they ensure that there is no chance that I will ever write a Metro app. Which means WinRT, along with all of the other new Metro-only features, are so much noise to me. And the sad thing is that none of those restrictions are even necessary.

  10. Josh Smith says:

    David,

    Thanks for your feedback. I didn’t get into the pros and cons of Metro style apps because that was not the intended focus of my blog post. I don’t have a fully formed opinion on that yet.

    I agree that the restrictions imposed on Metro style apps will be contentious for many people accustomed to the traditional Windows desktop app model. But, at the same time, Metro style apps are not a replacement for the old way of doing things, which muddies the waters a bit. Also, restrictions can be lifted, so only time will tell what this WinRT thing actually turns out to be.

    Thanks,
    Josh

  11. Brian Lowe says:

    I was reading just so I don’t completely lose touch with what’s happening in the Microsoft world, right up until the bit where I learned there’s a dev preview that could go into a VM. My iMac has plenty of space for VMs. I think I might give it a try!

  12. Thanks, Josh, for your thoughts about WinRT and the new developments from Microsoft. I look forward to your opinions about Metro.

  13. Hi Josh, at first I want to thank you for all of your fascinating articles!Thank you, man! Windows8 is a revolution – not only for developers, but for all users, power users and future geeks! I can only repeat what was told so often at //build: Use this chance, develop great apps and get rich! Not only in money but new, exciting experiences regarding development! This is so amizing and mind-blowing!

  14. Pete says:

    Metro sounds to me like Silverlight Out-of-browser. Is there more to it than that?

  15. Craig says:

    With Win8 the line between WebApp and DeviceApp blurrs. This is a welcome thing.

    But it comes at a cost. It seems to be highlighting the line between NewDeviceApp and OldDeviceApp.

    Interestingly, with the continuing diversity of PhoneApp platforms coming out I found myself migrating towards WebApp development. Win8 seems to be pushing me further in that direction. How else will my app be cross-Win8 compatible? I want my LoB apps to run on the Metro-Shell and the Retro-Shell.

    I like the security model I see in WinRT for MetroApps. I look forward to the day when my WebApps can access the metal by playing nice with new OS App sandboxs like WinRT.

    I think my favorite thing coming with Win8 will be asp.net 4.5

  16. Dan says:

    Hi Josh,

    I have an EP121 and installed Win8 on it. Did you have trouble getting the mini-HDMI adapter to work? It won’t recognize that I have a mini-HDMI to HDMI cable plugged in and connected to a 22″ monitor. Intel HD Graphics driver seems to be up to date. I can’t see any hint of HDMI in the Device Manager.

    Thanks for your great post.

  17. WinRT’s DependencyProperty class doesn’t have the static ReadOnly property creation methods, and if there’s value coercion I can’t find it. You might want to make some noise about this, there’s no reason to omit these with a year to go.

  18. ianredux says:

    I thought it was funny you saying it was just a little slate powering it all. That thing has an i5 processor and is more powerful than the work PC I’m writing this on!

    It’s an interesting time, so nice to read a more positive take on the developments.

  19. Josh Smith says:

    @Dan – I didn’t have a problem getting my EP121 hooked up to an external monitor. Not sure how to help on this one…

    @Joshua A. Schaeffer – I have heard quite a few complaints about the DPs in WinRT so far. Hopefully that will change before RTM.

    @ianredux – Yeah, it is funny. By “little” I meant the physical size of the machine, not the horsepower! 🙂

  20. Joshua A. Schaeffer says:

    Another thing I saw that bothered me was that IntelliSense showed VisualTreeHelper but not LogicalTreeHelper… are they really planning to dumb this down so badly that it cuts off our evolving best practices at the knees?

  21. npolyak says:

    I have the same take on it as some readers above. WinRT is great and long overdue, Metro is too restrictive in almost every sense.

  22. Nick Polyak says:

    BTW, according to my understanding one can also develop non-metro style apps (usual desktop apps) using WinRT even though at this point WinRT provides only a subset of win32 functionality. I also understand that the goal is to expand WinRT functionality to completely replace win32 and use it exclusively for both metro and desktop development.

  23. Rich Carpenter says:

    Not impressed by the performance of Win 8 on the ASUS EP121 slate. At $1000, the performance *should* be great. Doesn’t make much sense to spend that kind of scratch on a slate, just to plug in a keyboard and 23″ monitor, when an equally capable laptop can be had for less.

    This whole tablet craze is kind of silly – they way they are being treated like square pegs in round holes. The fact that Microsoft is going all in with it is more than a little unnerving.

  24. David says:

    Is it just me or has the WPF world suddenly gone very quiet?

  25. Tyrone says:

    We are in the process of creating a SOA line of business application and I am not undecided with regards of the UI….

    1. Silverlight?
    2. ASP.Net?
    3. WPF?

    What would be the safest bet with regards to the future????

    Thank you,

    Tyrone