Straight talking 63

by Tim Anderson

Tim Anderson puzzles out the future of Windows, and why XAML development in Visual Studio falls short.

HardCopy Issue: 63 | Published: May 20, 2014

Businesses today are still buying Windows 7, judging by the number of PCs and laptops I see advertised as “Windows 8 with Windows 7 downgrade pre-installed” or equivalent. That is hardly a good omen for Microsoft’s bold touch-friendly reinvention of Windows, and a shame considering that, whatever you think of the tiled ‘Metro’ user interface and Start screen, Windows 8 improves on Windows 7 in the core operating system, and is highly compatible on the desktop side. But given the poor take-up for Windows 8 ‘Modern’ apps, what is Microsoft’s future strategy on the client side?

build 2014

That question was largely answered by two recent events: the annual Build developer conference, and the launch of Microsoft Office for iPad a few days earlier. The arrival of Office on Apple’s tablet signals that Microsoft is serious about supporting non-Windows clients in its wider mission to run cloud services. The significance of Office for iPad is not just that it exists. The high quality of the suite, which fits smoothly into iOS rather than looking like a port, shows that Microsoft’s engineers can do excellent work beyond Windows. Office for Android is promised, and an improved web version will even make its way into Google’s Chrome Web Store.

These developments indicate that Microsoft has some sort of game plan for a post-PC world. But what of Windows itself? At first glance, the company appears to be in a conciliatory mood when it comes to Windows 8 complainers. Attendees were shown the latest Windows 8 update, which integrates the taskbar across both Modern and desktop environments, and then a glimpse of a future free update which will restore a desktop Start menu alongside a new ability to run Store apps in a desktop window.

Is this the end of Metro? On one level, it does make Windows 8 more like Windows 7, so you can frame it as a kind of retreat. Look deeper though, and it is apparent that Microsoft is not going back on its plan to persuade developers to target Store rather than desktop apps. Another way of looking at the forthcoming changes is that, from the user’s perspective, a Store app can look like a desktop app, as in started from the taskbar or Start menu, and running in a window. No longer will users be pushed into a different environment merely to run a Modern app.

The pleasure and the pain of XAML

In my copious spare time (ha!) I have been developing a Windows Store app. I picked XAML and C# over HTML and JavaScript, despite hints that the latter is an easier approach, mainly because I prefer the C# language (and more so after learning at Build of interesting new features like true native code compilation).

The exercise of developing a Store application of even moderate complexity soon reveals both the power and the awkwardness of putting together a user interface in XAML. In XAML, any user interface element can be customised and transformed, and I found myself learning how to change a ListView from a scrolling vertical list to a fixed horizontal panel, through the magic of Styles and Templates.

The snag is the challenge of puzzling out the XAML. This isn’t helped by Visual Studio and Blend’s habit of generating large amounts of code which you then have to wade through to find what you want to change. In my case, the simple task of disabling the check mark that appears when you click an item in a ListView requires steps beginning with right-click and Edit Additional Templates, to find the hitherto hidden attribute SelectionCheckMarkVisualEnabled.

I had a conversation with a XAML speaker and expert at Build. He advised me never to change anything using the visual designer in Visual Studio, since it generates height and width attributes which mess up auto-scaling. He prefers to live in the code view, so get used to lots of angle brackets.

It is not the easiest environment to learn, especially given additional tasks like behaving nicely in split views, or when the user changes from horizontal to portrait, to say nothing of dealing with Suspend and Resume in a transparent and user-friendly manner.

Microsoft has made several attempts to create simpler development environments, such as Project Siena which is an app-building app, and the online App Studio, which now supports Windows 8 as well as Windows Phone, but these tend to be over-simplified to the extent that developers cannot accomplish what they want.

My preference would be for an improved development environment within Visual Studio itself. The tools for the C# language are now wonderfully productive, but those for XAML fall short. If Microsoft is serious about making the Windows Runtime the target of choice for developers, a better development experience in its premier tool, rather than a proliferation of alternatives, would assist the transition.

There are also changes to the sandbox in which Modern apps run. If an app is side-loaded – that is, installed via PowerShell or a company portal, rather than from the public Store – then it can be configured to interact with desktop applications and libraries via two new features. One, called Network Loopback, lets Modern apps call web services on the local machine. These web services might query a local or remote database and return results to the Store app, for example. The other, called Brokered Windows Runtime Components, allows Store apps to load desktop libraries specifically coded for that purpose. Both these feature are available now, via the new Windows 8.1 Update. They are reserved for side-loaded apps to ensure they do not compromise the security of general users installing Store apps.

At Build, Microsoft also introduced Universal Apps. These are implemented with a new Visual Studio 2013 project type which lets you add multiple targets to a Store app. The main additional target is Windows Phone 8.1, now in preview, though adding a target for Xbox One was also demonstrated. A Universal App has three projects in a single Visual Studio solution, one for Windows Phone, one for Windows 8, and a third which is shared. If you create or move code into the shared project, it is merged into both of the other projects when compiled. This means you can share most of the code in a multi-target application (including user interface code if you wish), but still keep target-specific code when needed.

Underlying the Universal App is a near-complete implementation of the Windows Runtime, the engine underneath Windows Store Apps, for Windows Phone. This means greater compatibility between the two platforms, though the old Silverlight platform for Windows Phone is still supported.

Another significant demonstration at Build was Microsoft Office implemented as a Store app. Attendees saw an early build of PowerPoint, with a look and feel more like that of PowerPoint for iOS than Windows, but with a fuller set of features. The new Office (which looks at least a year away) will run both on Windows Phone and Windows 8; in other words, it is a Universal App.

The arrival of Office as a Store app is significant for several reasons. First, it means that Microsoft itself is implementing a large and complex app in the new environment (using C++ and XAML, we were told), which means that the internal teams will have a strong incentive to improve the performance and reliability of the platform. Second, it will bring true touch-friendly productivity to Office for the first time (as opposed to the nod towards touch users found in Office 2013). Third, it removes the main reason for the inclusion of the desktop in Windows RT, the ARM-based version of Windows 8.

It is reasonable to speculate that a future equivalent to Windows RT may actually run the Windows Phone OS. Users will still get Modern apps and Office, but the unpopular ARM-based Windows 8 may not exist in future.

Putting this together, it seems that rather than diluting its focus on Modern apps, Microsoft is emphasising it, despite the slow start for the Windows 8 Store.

There is one large problem with Microsoft’s strategy. Businesses, as noted above, are still choosing Windows 7, which cannot run Store apps, making it unlikely that we will see immediate huge growth in custom Modern app development. This is why the company’s efforts to make Windows 8 more appealing to desktop users are also critical, since it has to win them over in order to establish the newer platform.

Another issue is that, although the new Universal App project makes it easy to port a Store app to Windows Phone, it does little to assist developers in porting existing Windows Phone apps based on Silverlight.

Microsoft remains a long way behind iOS and Android in mobile: hence its dual strategy of first, trying to fix Windows 8; and second, offering strong support for its cloud services on those other client platforms.

Perhaps the most popular session at Build, outside the keynotes, was Miguel de Icaza (the original developer of Mono, open source .NET) explaining how to code for iOS and Android using C#. Like Microsoft, even core Windows platform developers are getting the message that they can no longer live in a Windows-only world.