This is the zeroth (introduction) in a series of Tutorials aimed at iPhone developers who want to learn how to port existing applications or create new applications in Windows Phone 7.
About these Tutorials
The series will consist of brief tutorials, with a focus on the minimum you need to know to add Windows Phone 7 development to your skill set.
Hardware and Software Requirements
Hardware
For all practical purposes, your choices come down to using a PC or a Mac with Bootcamp and…
- 3 GB of disk space
- 2GB of RAM
- A DirectX 10 capable graphics card with the WDDM 1.1 driver.
Note: you cannot run the Windows Phone 7 (WP7) Emulator under a virtual machine such as Parallels or Fusion |
Software
- Windows 7 http://bit.ly/w7Home or Windows Vista. In either case, any edition and both 32bit and 64 bit are fine, but you cannot use the Starter Edition of either for WP7 development.
- Windows Phone Developer Tools http://bit.ly/wp7Tools This one free download includes everything you’ll need once your Operating System is in place:
- Visual Studio 2010 Express for Windows Phone Beta
- Windows Phone Emulator Beta
- Silverlight for Windows Phone Beta
- Microsoft Expression Blend for Windows Phone Beta
- XNA Game Studio 4.0 Beta
Update: the Windows Phone Developer Tools January 2011 Update is now available.
Note that there are numerous programs in which you can get Visual Studio 2010 (the full edition) and much more for no cost. Among these are the BizSpark, Dream Spark and WebSiteSpark
The Marketplace
To sell your WP7 applications through the Marketplace, you have only to register, which you can do at http://developer.windowsmobile.com.
Key Concerns
iPhone developers often express one or more of the following concerns with regard to adding Windows Phone 7 to their target platforms,
- What about performance?
- I’m a game programmer – I thought Silverlight wasn’t for games
- MVC & MVVM
- Objective C & C#
- Coding for two platforms
What About Performance?
An incredible amount of work has been put into ensuring not only excellent performance, but smooth animation. I will cover the dual threading that has been implemented, as well as performance tuning, in one of the early tutorials, but the short version is that it is not rocket-science, and by and large you can and should ignore performance tuning until you complete your program.
I’m a game programmer – I thought Silverlight wasn’t for games
You certainly can write some games in Silverlight, but if you have a high performance game and/or want 3d or you have many assets to manage, you may well prefer to write your game using XNA. That’s fine, because WP7 programs can be written in either. And in any case, whichever you choose for a given application, you can still use classes from the other. Here are some general guidelines to help with understanding the strengths of each of the two platforms (from the Windows Phone 7 Developer Portal).
Use Silverlight if… | Use XNA if… |
You want a XAML based, event driven application framework. | You want a high performance game framework. |
You want rapid creation of a Rich Internet Application-style user interface. | You want rapid creation of multi-screen 2D and 3D games. |
You want to use Windows Phone controls. | You want to manage art assets such as models, meshes, sprites, textures, effects, terrains, or animations in the XNA Content Pipeline. |
You want to play digital media. | |
You want to use an HTML web browser control. |
MVC and MVVM
Patterns are key to both iPhone and WP7 development, and fortunately, the Model-View-ViewModel (MVVM) pattern is very closely related to MVC (the evolution was from Model-View-Controller to Model-View-Presenter (Fowler) to Model-View-ViewModel). Again, I’ll devote an entire tutorial to this early in the series, but here’s a 1 minute overview.
In fact, the three core concepts of MVVM are virtually identical to those in MVC:
1 Separation of Concerns
Do not let the User Interface (View) affect your Business objects and behaviors (View Model), which in turn is abstracted away from your data objects (Model) and of course your persistence mechanism.
2 Don’t Look Up.
We tend to conceptualize the View (User Interface objects) at the top, the ViewModel (objects that provide the UI with its data and behaviors) in the middle and the model (often the persistence layer) at the bottom. The View can know about the ViewModel, the ViewModel about the Model, and the Model, like the cheese, stands alone.
3 Implement through Binding – No user code in the View
In MVVM the mechanism for the ViewModel to provide data to the View, is for the View to set the ViewModel as its DataContext. The details will follow in the tutorial on MVVM, but for now, take my word: this is wicked cool.
Why’d Ya’ Call It ViewModel??
I actually think there is some elegance in this name. The ViewModel is the bridge between the Model and the View; and the ViewModel thus owns responsibility for binding the relevant data to the view and for handling user actions appropriately, whether the response is in the control, elsewhere in the View or in other parts of the application. You can learn more about MVVM (if you can’t wait!) in my posting MVVM – It’s Not Kool-Aid
Objective C and C#
In addition to learning the frameworks, and becoming comfortable with Visual Studio (and perhaps Expression Blend), you will be making the jump from Objective C to C#. Like Britain and the United States, these are two frameworks separated by a common language, as C# and Objective C are, arguably, nearly as alike (and nearly as different!) as British English and American English.
British | American |
Petrol | Gas |
Biscuit | Cookie |
Windscreen | Windshield |
And Bob’s Your Uncle | And You’re Done |
*myPointer = 5; | myReference = 5; |
I will point out the key differences between the languages as they come up, and will devote an early tutorial to exploring the differences in depth, especially where the same word is used in different ways.
Coding For Two Platforms
Here is the nub. Is it worth it to put your application on both platforms? A better way to ask is this: is the additional revenue and satisfaction higher than the cost? A good way to make the answer to this a resounding “yes” is to architect for multi-platform development, and we’ll devote at least two tutorials to that topic. The short answer, of course is that by starting out with MVC/MVVM you are already much of the way there, as the “logic” and “data” of your two programs should be (nearly) identical.
Resources
The series outline will be available on my blog site, updated frequently as the series evolves. In addition, the tutorials will point to material where you can find greater details, depth or source code.
The i2W triplet will be used in all areas when there might be confusion for iPhone developers in Windows Phone 7 syntax or idiom .
11 Responses to iPhone to Windows Phone 7