On October 11th Microsoft announced the release of Windows Phone 7 on 10 devices from a variety of manufacturers all over the world. Thousands of applications are already available on the Windows Phone 7 marketplace.
For Windows Phone 7, Microsoft went back to the drawing board to figure out what phone users really want, and built a phone from the ground up. The OS, the user experience, and the application development platform have all been engineered with users in mind. The revenue opportunities in the Windows Phone marketplace, accompanied by a great set of development tools, make WP7 a very attractive destination for developers to build applications and games.
In early September, Microsoft released a set of tools for Windows Phone 7. This toolset is free and can be downloaded from here. The toolset includes:
- An IDE (for developers) : Visual Studio Express for Windows Phone,
- A User Interface design tool (for designers): Express Blend for Windows Phone,
- Frameworks: Silverlight for Windows Phone and XNA Game Studio for Windows Phone
- And a Windows Phone 7 emulator to test and debug applications.
The tools are designed to let you develop consumer applications, business applications or games.
Windows Phone 7 Architecture
Windows Phone 7 utilizes a layered architecture as shown below. In contrast to the iPhone iOS, WP7 will run on multiple phones. To provide a consistent user experience and features that developers can rely on, it defines a minimum set of hardware specifications that all phones must meet. They include an ARM7 CPU, a DirectX capable GPU, a camera, and a multi-touch capacitive display. Standard sensors include: an A-GPS, an accelerometer, a compass, proximity and light sensors. There are three standard physical buttons on the phone - back, start and search. As we will see in a subsequent chapter, these buttons provide an easy and natural navigation model for the user.
In WP7, Microsoft provides most of the device driver code. The device manufacturer has to write very little code specific to their device. This is expected to improve the consistency and quality across various devices. WP7 takes advantage of hardware acceleration through encapsulation layers such as DirectX or XNA.
WP7 applications use managed programming and run within sandboxed environments. Watch this MIX '10 presentation by Istvan Cseri , a Windows Phone 7 architect to get more details on the WP7 architecture.
Comparing the WP7 Programming Stack with the iPhone Stack
The App Model shown above provides services for managing the application lifecycle such as installation, and update. The UI model helps manage application user interface. Applications are built using various WP7 frameworks.
The following table gives an overview of the Windows Phone 7 frameworks that provide features comparable to the iPhone programming layers.
iOS and WP7 Stacks side by side
The following table provides a detailed look into the framework layers shown above. The left hand side shows the iPhone stack with the corresponding framework from Windows Phone 7 on the right. These frameworks can be grouped in three large buckets, namely, Application UI and Phone integration, Base services, with the OS layer underneath.
Managed Code only
On iPhone, you have been using Objective-C. WP7 only supports "managed code" applications using C# or VB.net; there is no "native" access to the system or phone hardware. Execution of such code is managed by the .NET Common Language Runtime (CLR). One of the benefits is that CLR provides garbage collection - there is no memory management to worry about or pointers to take care. The WP7 application stack is built on .NET compact framework 3.7. The .NET compact framework is optimized for resource constrained devices and is designed to be portable across various hardware platforms.
WP7 Base Class Library classes roughly correspond to those provided in the Foundation framework in the iOS Core Services Layer. They include base classes, collections, threading, text processing and IO. The WP7 Base Class Library layer also includes networking stacks, such as HTTP and the Windows Communication Foundation (WCF). WCF provides an easy interface XML and SOAP services across the web with features supporting XML data transfer, serialization/deserialization and XML parsing. While WP7 does not have a local database such as SQLLite, developers can write SQL like queries in C# using Language Integrated Query (LINQ) to query XML data, stored in isolated storage (see below), or in remote databases such as SQL Azure.
Application UI and Device Integration
WP7 - Two Options for Applications UI
If you are using the iOS Media layer frameworks, you have two stacks to choose from in WP7, namely, Silverlight and XNA. While you can use either, generally, it is recommended that you use Silverlight for consumer or business applications and XNA for games, although you can also develop great games using Silverlight animation.
XNA for Games
XNA framework, originally developed for XBOX, provides hardware accelerated 2D and 3D rendering and bitmap graphics. XNA also provides gamer services such as authentication, connectivity with XBOX Live as well as profiles and leaderboards. For a high performance game, XNA is the right option.
Silverlight Controls and Media
If you have been using Cocoa Touch for controls and multi-touch, you will find a large set of Silverlight UI controls specifically designed for the phone and supportting multi-touch. Silverlight uses a declarative language called Extensible Application Markup Language (XAML) to specify user interfaces. Developers can use separate code behind files, written in C# or VB.NET, to respond to events or manipulate the controls.
Silverlight provides high performance audio and video with variety of CODECs. It supports both vector and bitmap graphics with hardware acceleration. As opposed to a file system, Silverlight provides sandboxed storage, called isolatedStorage, to store the application specific data. With the isolation of storage, one application cannot affect other applications that are running on the phone.
Windows Phone Frameworks
If you need to use HTML in your application, you can use the IE-based browser control in your application for HTML UI. Windows Phone framework layer also provides interfaces to various sensors, such as the accelerometer, or the camera. Similar to Apple's notification service, Microsoft provides a push notification service, called Microsoft Push Notification Service. In iOS 4.0, Apple introduced multi-tasking and iAds for advertisement support in the application. While multitasking is not available on Windows Phone 7, Microsoft has recently released Microsoft Advertising SDK for Windows Phone 7.
In this chapter we looked the Windows Phone 7 architecture and the two programming stacks. Now that you have a high level idea of how the WP7 programming stack maps to the iPhone stack, we are now going to go one level deeper. In the next chapter, we will look at the user interface guidelines of WP7 applications.
To go deeper into the topic discussed, check:
- App Hub - Central place for Windows Phone 7 development. Getting started, download tools and read all about Windows Phone 7 development
- MIX '10 presentation on Windows Phone 7 Architecture by Istvan Cseri
Other Resources you may find useful:
- Overview of the Windows Phone 7 Application Platform
- Windows Phone 7 team blog.
- Windows Phone 7 Programming: Programming guide and reference documents.