The New Windows 8 Developer: the Big FAQ for iOS devs
Before I was lured back to working at Microsoft, I was making a living as an iOS developer. Since my return to the center of the universe that is Redmond, I’ve been getting up to speed writing code for Windows 8.
I thought it might be useful to share what I’ve learned so far, and give you some pointers and links in case you are also thinking about developing for Windows 8.
As you go through the following long, long post, please remember that I’m not an official spokesperson for Microsoft. I’m hoping I’ve not said anything that will require my Microsoft overlords to issue a statement disavowing me, but at the same time, I’ve tried to be frank and honest and explain things as I see them. (Update: I've just been informed that of course I am an official spokesperson for Microsoft simply because I'm a Microsoft employee and therefore a representative for the company, and just saying I'm not doesn't mean I won't get into trouble if I say something stupid. See the risks I take for you?)
If I’m wrong, or you disagree with something (all?) I’ve said, please feel free to post comments.
Q. What is the difference between Windows 8 apps and, you know, regular Windows apps?
A. With Windows 8. Microsoft introduced a brand new platform called Windows RT. If you know "old" Windows (95, XP, Vista, 7..), you know Win32 – a fantastical set of APIs which have existed since the dawn of time, and which have grown into something no sane person can manage to keep track of. WinRT throws this away, and starts again, with a new API SDK that is modern, actually quite nice to program with, and which also happens to run on ARM hardware as well as X86 hardware.
The most visually differentiating thing about Windows RT is the colorful tile-based interface, but that’s only the start screen. Underneath, Windows RT is using new WinRT SDK, which you can write apps against. When Microsoft and developers talk about writing "Windows 8 apps" or "Windows Store apps" these are the apps to which they are referring.
This means that Microsoft now has two major flavors of Windows: Windows RT (which is this WinRT system) and Windows Pro (which includes the ‘desktop’ Windows you are probably used to, and the new Windows RT). Windows Pro marries the two worlds together, using the Start button as the point where they meet.
If you walked into a computer store (well, a computer store that didn’t have a giant fruit logo over the door) you would find computers (laptops and tablets mostly) which run Windows RT only, or which run Windows Pro (and Windows RT as well). The advantage of the Windows RT computers is that they can use lower-power hardware (those ARM processors for example, or Atom processors perhaps) and so are lighter and have longer battery life. The disadvantage is that they won’t run the ‘desktop’ apps you might be used to.
If I’ve just managed to confuse you, look up the Microsoft Surface device. It comes in two models; the Surface RT, which is cheaper and runs Windows RT and the Surface Pro, which is a little beefier and runs Windows 8 Pro (but also Windows RT, hence the now familiar tile interface).
Of course you can continue to write ‘desktop’ apps for Windows 8, but it’s the Windows RT based apps – known officially as Windows Store Apps – which is where the interesting stuff is happening these days. These are the apps using the new WinRT SDK, with the newly designed user interface controls, minimalist design philosophies and all that jazz. It’s these WinRT apps which Microsoft created an app store for you to use to sell your apps and make lots of money.
Q. What’s the link with Windows Phone 8?
Now, as computing devices they have a lot in common, but they are still different. How different? Probably somewhere in the middle between the difference between iOS and Mac OSX and the difference between iPhone and iPad. You can share a lot of code between projects (heck, you can have a project for each open in the same Visual Studio solution, and share the same source code), but you do need to build for each individually. And of course take into consideration the user interface differences. Here's a good overview. But if you are writing code for one device, you won’t have a difficult job writing it for the other.
By the way: each device has its own separate app store. You can’t sell the same app for both platforms on one app store.
Q. What interesting features are available on Windows 8, compared to other platforms?
A. If you are like me, as a developer, you are interested in two things:
1. Can I make money from this to fund my out-of-control shiny new hardware habit?
2. Will it be fun writing code for this platform?
To deal with the first part, think of it like this: the potential user base is BIG. I mean, really big. You might think it’s a long way to the chemists, but that’s just peanuts to.. wait.. I got distracted. Anyway, remember, this is Windows we’re talking about. Every computer than can run Windows 8 can download your app. That’s a lot of potential customers. This is an interesting time to get into Windows development – the Windows Store is still new and the market is evolving, and if you do something new on Windows 8 you’re probably the first to do it period.
Will it be fun? I think you might be surprised how fun it is. Visual Studio is renowned as an excellent developer IDE. It has a long history, and it’s mature and powerful. It supports multiple programming languages, and you can mix them up within the same project. It has Interface Builder-type UI tools for adding controls, and comes with a standalone editor called Blend which seems like a mix of Flash, Photoshop and Xcode for when you are wearing your hipster Designer Hat (want to make an animated button? Add keyframes to a timeline and export that into your C# project in a few seconds).
Visual Studio is easily extensible. You can download and install new frameworks using a built-in tool called NuGet, and you can add amazing Refactoring tools (such as those from JetBrains) that change the way the IDE works.
Working with developer certificates, uploading to the Windows Store and all that stuff is not going to drive you crazy.
And last, but not least, you can get to access some very nice new technologies such as Azure for Mobile devices, Bing maps, and all the new Windows 8 UI controls.
If you are used to UIKit, you’ll find Windows has a difference approach in many ways. For example, I would pretty much use UIImage controls as sprites or abuse UIButtons as game pieces in my apps. This isn’t going to work so well in Windows apps, but there are plenty of alternatives as we’ll see.
Q. Ok. I might be interested. What do I need to start writing Windows 8 Store apps?
A. You will need:
2. A copy of Visual Studio. You can download free copy of Visual Studio Express, or buy a version which has more features.
3. A few hours to read the Windows 8 Dev Center and work through some code examples.
4. A developer account. You will be prompted to create one from within Visual Studio when you start working. You will need to sign up for a paid account when you start selling the apps on the Windows Store, but you do not need to pay to run apps on your local PCs.
Q. I’ve just launched Visual Studio. Whoa! Which programming language should I use?
Which one to use? This is almost a religious question, but there are certain circumstances in which one language trumps another. In other words, you need to pick the best tool for the job.
If there is one ‘natural’ language for development, it would be C#, because C# was created to work with many of the technologies which modern Windows likes – the .NET framework, and XAML for example.
C++ is still there, and in fact, if you want to do some serious low-level high-speed graphics work, you’ll need to dust off your mad C++ skillz and wrap your head around DirectX (which is to Windows as OpenGL is to OSX/iOS). C++ is super for graphics, but less super for quickly putting together app-like user interfaces with buttons, scrolling lists and all that good stuff.
So what should you pick? Argh, the pressure to pick the right language!
Q. How difficult is it to learn this C# language? I mean, really?
A. C# will look familiar to you if you know C++ or Objective-C. Java programmers won’t be unsettled either. It reads like a programming language that makes good sense, and isn’t too verbose or picky. It will take a few days before you stop adding square braces to everything, and putting function return values in brackets, but you’ll get there.
Of course it has advanced features – every language does – and yet you don’t need to know them to get started. You can write an app without using generics or LINQ or wondering about the MVVC design patterns, just like you can write an iOS app without using the UIAppearance class or Object Collections. And in exactly the same way, when you do learn about these features you’ll slap your forehead and think how useful they would have been a week ago.
Visual Studio’s own autocomplete features (called Intellisense) will give you lots of help with syntax and object methods and properties.
Now, I’m biased, because about ten years ago I worked on the Visual Studio team and it was my job to write the C# documentation. But I think it’s a nice language, with lots of nice features that actively help me write nicer looking code that’s easier to read and maintain than others I’ve used. And I know a lot of developers who agree. Stackoverflow has an interesting discussion. The Windows Phone team created this guide too.
Q. XAML? What’s that again?
A. XAML is the variant of XML that is used to define the user interface of your app. XAML controls include things like buttons, grids, list views and so on, and you can either declare them by typing a lot of stuff that looks like <button x:name = "mybutton"> or by dragging and dropping them from a toolbox into a graphical representation of your app. Or, come to think of it, declaring them at run time.
XAML is very rich – which means you can tweak just about everything, rather than too much will make you sick. It’s also tightly linked with your code, so you can do clever things like writing apps which pull down data from the web, pass the details to the XAML control and the control will go off and display it all by itself.
XAML can also be editing using Blend, so your designer pals can make really cool UI without having to know a line of code.
Q. Where can I get some sample projects to get me started?
A. Visual Studio’s ‘blank’ projects are a great place to start of course, but they’re going to look sparse and empty. That’s probably why Microsoft created dozens and dozens of sample apps for you to play with. Some of these apps are pretty much finished: all you need to do is change the name and you’ve a working app. Here are some places to go looking:
Q. Do all my apps have to look like "Windows 8" apps?
A. No! Microsoft loves the look of their new WinRT controls (which used to be called Metro, then Modern and then I lost track – I think it’s just Windows Store Apps now). The look is angular, vehemently anti-skeuomorphism, grid-based, scrolling, boxy, negative-space-based.. there are lots of words to describe the look, and you’ll either think it’s a modern look that is badly needed in an age of faux leather stitching, or you’ll dislike it.
It doesn’t really matter, because you don’t need to write your apps to look like Windows 8 apps if you don’t want to.
The default controls (buttons, grids etc.) will definitely have this look, but all controls can be customized as you see fit. And if you don’t want your app to scroll left and right, well, don’t make your app scroll left and right.
Q. I want to write games. What are my options?
My advice is to play around with all these technologies. Some are better suited to specific game types than others, and all are free to evaluate. There are plenty of cross platform tools too – so you don’t have to limit yourself to Windows; your apps could also run on Android or iOS.
Q. Where can I get more info, samples and help?
A. The Windows 8 Dev Center is a good place to start (that’s the team I work with, writing docs to make your life easier). You should also check out Channel 9 (the media-crazy team who love making videos). Microsoft is spending a lot of time and effort to get information to developers, so you should definitely visit sites such as AppBuilder and sign up for everything you can. There will be many local events and competitions, and you’d be daft not to take advantage of them. The evangelism team can even meet you face to face to answer your questions, which is quite amazing.
Q. What is the future of Windows 8?
A. Bright, of course! Microsoft just announced Windows 8.1, which refines some features and adds plenty of others. And then there’s the hardware! Check out the latest Windows 8 device to hit the market: an 8 inch tablet running full Windows 8 from Acer. Doesn’t that make you want to write some interesting apps?