Home > Articles > Programming > Windows Programming

Top Ten Features Windows 8 Developers Will Love

  • Print
  • + Share This
  • 💬 Discuss
Windows 8 Metro is a new platform for developing applications that are tailored to the devices on which they run. These devices may include traditional desktops and laptops as well as the new tablet and slate form factors. In this article, Jeremy Likness, author of the upcoming book Building Windows 8 Metro Applications with XAML and C#, covers the top ten features developers will love about the new development environment.

In September 2011, Microsoft announced the launch of its Windows 8 operating system. This version maintains backwards compatibility with previous versions of Windows, and at the same time introduces the Windows Runtime (WinRT), an entirely new framework for Windows that provides developers a language-independent application programming interface (API) for creating Metro-style applications on Windows 8. Metro-style applications are full-screen applications that are tailored for specific devices, touch interactions, and the new Windows 8 user interface. Metro-style applications are also referred to as tailored applications. The introduction of WinRT is one of the largest paradigm shifts in the Windows development world since the introduction of .NET in 2000.

Metro-style applications are intended to be fast and fluid. They easily scale to the screen size of the device they are running on, adapt to the portrait or landscape orientation, and snap to run side-by-side with another application. They are launched from active tiles that can provide real-time “at-a-glance” information. They remain connected and alive so users can maximize their productivity regardless of the form factor they are using.

The new platform comes with a new set of tools. Visual Studio 11 was released to enable developers to create Metro-style applications in combination with Microsoft’s design tool called Blend of Visual Studio 11. The platform provides incredible flexibility for developing applications using the languages and tools most developers are already familiar with. This article covers the top 10 features that developers will love when making the switch to building applications that run on the Windows 8 Metro platform.

Programming Language Support

Metro applications are fast and fluid because many of the components and operating system APIs are written in native, unmanaged code. Unmanaged code refers to code that runs directly on the host machine without the Common Language Runtime (CLR) provided by the .NET Framework. The code is compiled directly to machine code instructions the host device understands and therefore can execute more quickly than managed code, or code that runs as part of the CLR. Code written for the CLR compiles to an Intermediate Language (IL) that is interpreted by the .NET Framework and compiled dynamically to local machine code instructions. This is referred to as Just-In Time (JIT).

One concern developers shared when they first learned about the runtime was whether support for the popular .NET Framework would be continued. With the release of the Consumer Preview (CP, a beta of Windows 8) in February of 2012, Microsoft confirmed that the .NET Framework is both alive and well (with future releases including version 4.5 in the pipeline) and that developers would still be able to leverage the language of their choice when building applications for Windows Metro.

Windows Metro applications can be built directly using unmanaged C++ code. They can also be built using the .NET Framework. The Windows 8 CP provides templates for building applications in both VB.NET and C#. Developers were surprised to learn that Visual Studio 11 supports a third model besides unmanaged and managed code to develop Metro applications: Hypertext Markup Language v5 (HTML5) and JavaScript. The Windows 8 team was able to provide a capability to project the local APIs into a library called Windows JavaScript (WinJS) that facilitates building the structure for applications with HTML5, styling them with Cascading Style Sheets v3 (CSS3), and coding them using standard JavaScript.

Here are three examples that all result in updating a label on the screen to display the text, “Hello, World.”

C#
HelloText.Text = "Hello, World.";
C++
HelloText->Text = "Hello, World.";
JavaScript
helloText.innerText = "Hello, World.";

What this means for developers is that existing .NET Framework developers can stick with the language they are familiar with to build Metro applications. C++ developers can participate. A whole new segment of developers familiar with web technologies now have a direct path to take their existing knowledge and build Metro applications using HTML5 and JavaScript. This is a very powerful feature, and it means that developers won’t have to learn a new language to begin developing Metro applications. They can also pull in existing code and libraries for their new applications. This should help facilitate migration of existing projects while allowing developers to leverage the tools and utilities they’ve already built.

XAML

A popular feature shared by Windows Presentation Foundation (WPF) and Silverlight was the use of Extensible Application Markup Language (XAML) to build the user interface. XAML is an XML-based declarative markup language that was developed by Microsoft. It is often mistakenly referred to as a user interface language and is compared to HTML. Although XAML is the key technology that drives the visual interface for Metro applications, it is not limited to creating UI elements. In fact, XAML drives other technologies on other platforms, including Windows Workflow Foundation (WF).

XAML is defined as a system for representing structured information. XAML contains three distinct nodes: objects, members, and text. The objects in XAML reference either CLR types that are instanced by the XAML parser or WinRT component calls, whereas members reference properties on the types, and text is used to set values. The best way to think about XAML is as a rich object graph that is defined declaratively using XML.

XAML allows for an easy separation of view and presentation logic from the rest of the application. With the popular Model-View-View Model (MVVM) pattern, it is possible to create classes that can be tested independently of the UI. The design team can work on the XAML interface independently of the development team, allowing for parallel effort through what is called the designer-developer workflow. This makes it easier to style and maintain the UI for projects throughout the entire software development lifecycle.

Here is an example XAML file that could be used without modification in either a C++ or a C# application for Windows 8 Metro:

<Grid Background="{StaticResource ApplicationPageBackgroundBrush}">
     <TextBlock x:Name="HelloText"/> </Grid>

Developers who are familiar with XAML will not only appreciate the ability to use the same markup to create Metro applications, but also the presence of tools like Blend for advanced style and design. XAML for Windows 8 supports the dependency property system, the Visual State Manager (VSM) and animations, three key features widely used in WPF and Silverlight. Many other familiar features like value converters are supported as well.

  • + Share This
  • 🔖 Save To Your Account

Discussions

comments powered by Disqus