Interview with Charles Petzold on WP7 development and more
Interview with Charles Petzold on WP7 development and more
Join the DZone community and get the full member experience.Join For Free
Charles Petzold is a software developer with over 20 years of programming experience. He has written more than 20 books on various topics ranging from programming for MS-DOS to programming for Windows Phone (a recent addition to his book list) and he is also a Microsoft MVP (Most Valuable Professional). Today I decided to take an interview from him about the general aspects of Windows Phone development, as well as asked some more generic, but interesting questions.
Dennis: You are known as a professional Windows developer and author of books on Windows development. You’ve got a great book on Windows Forms development, as well as general Windows development. What led you to the idea of starting developing for the Windows Phone 7 devices?
Charles Petzold: Two things: The hardware and the APIs. I think one of the most important things Microsoft has done with Windows Phone 7 is establish a very strong hardware standard. There are only two possible screen sizes, an enormous 480x800 and a smaller 320x480, and several other required features: four-point multi-touch, an accelerometer, a camera, WiFi, and location sensors. So right at the outset, programmers know what hardware we're targeting. Just as importantly, we can write programs for Windows Phone 7 using .NET managed code and C# -- certainly my favorite programming language and I think the favorite programming language of many other programmers.
Dennis: What was the hardest part (methodology, paradigm etc.) that you had to adapt to when switching to mobile development from Windows development?
Charles Petzold: There are two big paradigm shifts, I think. The first involves multi-touch. For the past 25 years or so, we've really been focused on getting user input from the keyboard and mouse. Now we have devices with an optional hardware keyboard, an on-screen virtual keyboard, but no mouse at all. Instead, people use their fingers to directly manipulate objects. This is a big difference, and properly using multi-touch is not trivial. Silverlight programmers who stick to standard controls will find the transition easiest, but I suspect these programs might be a little dull. You really want to get more intimate with the user by exploiting multi-touch. Multi-touch will also be a challenge for XNA game programmers, who will need to adapt their programs from game controllers to multi-touch and the accelerometer, which responds to orientation and shaking.
The second big paradigm shift involves front-ends and back-ends. We've been accustomed to client programs that use local file systems, or web programs that access sever databases. There's going to be a shift towards using web services. Obviously this has already been happening, but I think it's really going to be accelerated by phone development. We're going to be getting more program data from the cloud, and storing more of our own data in the cloud.
Dennis: Do you think that Windows Phone 7 will be a major competitor to the existing mobile devices, like iPhone or the Android, both commercially and development-wise?
Charles Petzold: You're asking that question of someone who thought the OS/2 Presentation Manager was going to make Windows obsolete. I'm just a programmer; I don't consider myself to be a good industry forecaster. But Windows Phone 7 has a great hardware platform, and there are plenty of Silverlight and XNA programmers ready and eager to code for it, so there's really nothing holding it back from becoming a major player in the smartphone market.
Dennis: Since XNA is a supported development framework, the common understanding is that XNA can only be used for game development. Will the developers be able to develop non-game applications with XNA or is that a Silverlight job?
Charles Petzold: I think the support of both Silverlight and XNA on Windows Phone 7 is a brilliant move. These are two very different platforms for the two different kinds of programs we're likely to see on the phone.
XNA is a terrific platform for 2D and 3D games. But it's missing a few features that we've come to expect in a graphical programming environment: There are no controls such as buttons, scrollbars, text boxes, or list boxes. There's no concept of layout, or input events, or input focus. There's not even any vector graphics support. For these reasons, programmers writing applications that rely on these features will probably be using Silverlight.
However, there's nothing to prevent an enterprising programmer from using XNA to write traditional controls, or to implement a layout system. XNA provides the basic building blocks, and all that's required is putting them together in the right way.
What you *can't* do on Windows Phone 7 is write a program that combines Silverlight and XNA code. You have to pick either one or the other.
Dennis: What is more challenging for you personally – working with XNA or Silverlight?
Charles Petzold: XNA programming is very new to me, but in one sense, I've been working with Silverlight for 7 years. I first started exploring Avalon in 2003, and I wrote an article about Avalon in the January 2004 issue of MSDN Magazine. Avalon eventually became the Windows Presentation Foundation. I wrote two books about WPF, and then WPF became the basis of Silverlight.
So obviously working with Silverlight on Windows Phone 7 is more challenging for me! I much prefer learning about new things, and that's what XNA is to me now.
Dennis: Are you going to develop some games/applications we can later find in the Windows Phone 7 app marketplace?
Charles Petzold: I've never been interested in getting into the commercial software business, so virtually all the code I write is for pedagogical purposes. I sometimes think of my job as writing the shortest programs I can manage to illustrate basic concepts! I would like to write some more substantial programs, however, and make them available through the Windows Phone 7 marketplace, but they'll probably be free, and I'll make the source code available.
Dennis: I think that most of your examples can be applied to commercial software as well, actually fitting in pretty easy – the code presented by you has the quality of being universal (personal experience reading your book on WinForms). Talking about code, is this your first experience developing games? If so, what do you like more – developing games or standard applications?
Charles Petzold: I've certainly written some programs in the past that could qualify as games, and I'm very familiar with animation, 3D, physics, and handling very interactive user input, but this is my first experience using a platform specifically designed for high-performance professional game development, and I'm liking it a lot. I'm not a big game player, though, and I've never been part of the gaming culture. In fact, I personally find the whole genre of first-person shooter games to be rather distasteful. But right at the moment, I'm enjoying XNA development more than Silverlight development.
Dennis: That’s great! XNA is something I am currently learning and find it extremely interesting. What would be your advice to developers, who want to start creating games/applications for the Windows Phone?
Charles Petzold: With small devices such as Windows Phone 7, the user interface becomes extremely important, so I'd advise to start thinking a lot about interaction and presentation -- multi-touch, orientation and movement, graphics and animation. These are the elements of an application that will separate the gems from the duds.
Dennis: Last but not least, some developers are concerned about the complexities of handling touch input. What are some integrated capabilities (bot in Silverlight and XNA) that make touch input handling more reliable and effective?
Charles Petzold: With XNA, you're pretty much dealing with tracking individual fingers as they come down on the screen, move, and lift up. However, Silverlight for Windows Phone supports a subset of the Manipulation events from WPF 4. These Manipulation events consolidate multiple fingers into translation and scaling information, so if the user does a two-finger pinch or expand on an element, your application gets back a corresponding scaling factor that you can use in a transform. These Manipulation events will make multi-touch input a whole lot easier for some standards uses. Of course, some applications will want something special, and going down to the lower level events will be necessary.
IMPORTANT NOTE: You can find Charles' website at http://www.charlespetzold.com
Opinions expressed by DZone contributors are their own.