• Windows Phone 8, from a developers standpoint.

    by  • June 25, 2012 • .Net, Journal, Programming • 0 Comments

    On the 20th June Microsoft publicly announced the next version of their Phone OS, Windows Phone 8. Along with it came a whole host of improvements, some on the surface for end users but quite a lot of new shiny for us developers.

    I will go through some of the new features and say how they will help Microsoft for the better bring additional developers to the platform.

    If you missed the keynote, you can head over to Channel 9 where they have the video stream hosted, or failing that browse YouTube.

    One thing that I should point out that gripes me is that Microsoft’s presentations as of late haven’t been that well polished, and no where to the level of Apples. Some may argue that the keynote was aimed at a technical audience but if you then compare it to Apples WWDC keynote where they announced the MacBook Pro with Retina display, I think Microsoft’s devs should be left to tinker in the basement.

    Higher Screen Resolutions

    When Windows Phone 7 was launched, the screen resolution of 480×800 was considered rather good, however the happiness was short lived with the introduction of the iPhone 4 and it’s Retina display. Soon enough Android phones jumped on the bandwagon and screen resolution became one of the key selling points.

    Android allowed for a whole host of arbitrary screen sizes, which in a way is a good and bad thing. Different screen sizes allowed for the Android OS to be ported and used in a larger number of devices but it had its drawback, most of the hard work fell on the developer to support these resolutions. Most only allows a few select screen resolutions or aspect ratios.

    Microsoft (and most of the industry saw this coming) and felt that having a fixed screen resolution would speed up development and deliver a consistent experience – something that Apple to their credit understood from the get go.

    The time has come however with the App market passing 100,000 apps and technology improving to add additional resolutions. This isn’t like Android where the resolution flood gates will open, but adding carefully picked sizes that are useful to the consumer, although I can understand about 720p, I still don’t fully understand 1280×768 unless they are going after better desktop integration?

    Existing apps will automatically be up-scaled, and new apps can take direct advantage of the new screen sizes. Microsoft hasn’t yet clarified however how this will be done, as Apple’s resolution was far more simplistic by just doubling the pixel density.

    Native Development

    One of the issues facing big companies when developing for Windows Phone 7 was that it required an entire rewrite of most of their logic code, and they didn’t have access to a variety of industry standard rendering and middleware software. This was all because at the beginning everything was ran using managed code (C#).

    This did have it’s plus points, it meant developers had to use the managed runtime on the relatively new system. This meant their code was a lot more consistent, easier to debug and faster to get to market. The only downside was performance, but during the initial release phase, performance wasn’t much of an issue for casual games and Microsoft provided XNA which was a great managed framework for making hardware accelerated games for Windows Phone 7 and the XBox.

    Now the market is more mature, it has become the right time to introduce native development for developers who have more experience in the platform, and are becoming ever more required due to the increasing number of sensors and inputs that need to be processed – such as access to raw camera data in Mango for augmented reality apps.

    To compliment the native code development Microsoft has ported the majority of the DirectX codebase to Windows Phone as part of their shared codebase initiative meaning virtually everything big Windows has, the phone has too, considerably reducing the porting time for middleware software companies.

    With Native development in C and C++ comes a whole host of middleware from the likes of Havok and many others, which mean games can be developed faster and using prebuilt libraries. Most modern games are written in C and C++ anyway so it considerably reduces the amount of time needed for porting and makes releasing a game for Windows Phone 8 an easy choice if you are already releasing for the Windows desktop or XBox. I believe this will be one of the key winning points for Windows Phone 8 as I would join the queue of people wanting a WP8 if they port COD: MW3 to the platform.

    App Store Pre-compilation

    Ever since the .Net Compact Framework came out, one of the big gripes with it was the lack of NGEN.exe what’s that you may ask? Well it is an application which is bundled with Visual Studio & the Windows SDK that allows for full .Net code to be precompiled to native code.

    Why is this useful in general, and why is this great for Windows Phone? All .Net applications are compiled from their original language (C#, VB, F# etc…) to CIL (formally MSIL) which is an intermediate language that the Common Language Runtime (CLR) interprets. At it’s heart, all .Net languages are interpreted by the managed runtime.

    This would be hugely slow if it were not for JIT’ing, the process of Just In Time compilation. When an assembly is loaded it’s metadata is cached and when a method is called for the first time, the CIL code is compiled to architecture specific native code. This code is cached and each execution afterwards uses the native code (unless the cached code has been removed from memory) which results in the huge speed improvement.

    What NGEN does is do all this JIT’ing in advance, so all the code is stored as native code. The only downside in most instances is that when different architectures are involved, you need a different binary for each. Windows Phone 8 doesn’t have this problem as there is only one architecture.

    Performing NGEN on the applications should be transparent (unless they do weird stuff by internally accessing the structure of the executable binary) and will help improve startup time and overall performance.

    Internet Explorer 10

    The browser wars continues with Internet Explorer 10 for Windows 8 and Windows Phone 8. Microsoft claims it has the fastest JavaScript engine (according to SunSpider) but things can change. One thing I noted was during the presentation Microsoft compared the runtime in the iPhone 4S and Galaxy S II (not III) and did not mention whether the pages were pre-cached, this might be a case of some future back tracking.

    What does this mean for developers: faster, more efficient websites which are more standards compliant (no one is never truly standards compliant). If you are using web based frameworks such as PhoneGap to build your application you will see faster launch times and more responsive apps.

    One of the key features of IE10 is improvements to it’s JavaScript JIT’er which allowed the large performance enhancement. What Microsoft was able to do was improve how it parses the code tree to determine which parts need to be JIT’ed, for large Javascript frameworks, most took the object approach to contain variable scope, a very crude example of the Object model approach:

    var BaseObject = new function() {
    BaseObject.ObjectMethod = new function() {

    Full .Net Support and Shared Codebase

    Originally the codebase for Windows Phone 7 was based on Windows CE, a power efficient cut down version of Windows which for the large part had a separate codebase. This was good as it was lean and only had what it needed, drivers were small and ran fast and it helped get the most out of the hardware. It was bad because drivers had to be written twice, once for big Windows and another for Windows CE. The problem came because most developers ignored Windows CE which meant a large proportion of hardware devices don’t work correctly or have all the features enabled under Windows CE.

    To aid hardware developers bring equipment to market faster, and to make overall better quality code. It was decided to merge the code branches of some of the functionality. This means that the code only needs to be written once and allows for it to be debugged more intensely; resulting in a better experience and few crashes.

    By adopting parts of the Windows Kernel codebase Windows Phone 8 gets a whole host of security enhancements and performance optimisations that did not exist in Windows Phone 7 for a modest (alas acceptable) memory footprint increase.

    Along with this shared codebase, development has moved away from the .Net Compact Framework and towards the full .Net framework, allowing for a much richer coding experience, and means porting is again considerably easier.

    MicroSD expansion

    This was an annoyance that nagged me through the first set of devices that ran Windows Phone 7 (and I’ve had a few HTC Mozart, Samsung Focus Flash, LG Opt etc.) They usually came with just 8 or 16GB of RAM. Now thats fine for a common user but completely blocked out the high end of the market due to:

    • No upgrade paths (eg. iPhones come in 16 /32 /64GB options)
    • No user accessible expandable storage.

    This was a big hiccup for me as I wanted to have games / apps / music / movies all on my device but with most just having 8GB of storage this was a no go. With Windows Phone 8 we shall start to see the introduction of external storage.

    What Microsoft hasn’t yet said is how this will be accessible / configurable and also hopefully they will learn from Android and not allow applications to be stored on external memory cards as that is usually SLOW! – What usually happens is OEMs bundle the cheapest(usually slowest) card they can find with the phone, users then get a less than great experience and blame it on the phone.

    Hopefully this will allow music and video junkies to abandon the iPhone ship and free up app developers to make more use of the phones internal memory.

    Voice Integration

    Shown off via a rather badly performed demo, Microsoft has enhanced its voice integration software by allowing applications to easily hook into it to perform system wide calls eg. “play Tighten Up by Black Keys” or in app calls “next page” Microsoft may have better application integration but it lacks:

    • Semantic context support – eg. understanding different ways people ask for things
    • Improved text to voice – still sounds like the XP / Win7 voice

    NFC & Wallet

    In a real kick to Android and Googles wallet implementation, Microsoft is pinning its hopes on the secure chip information being placed in the SIM Card and not the phone. I think this is rather risky as I don’t see many countries switching their SIM card designs, they had to for Apple otherwise they wouldn’t get the phone, but I doubt they will do it just for one or two additional functions. Having the secure functionality on the SIM also leads to the problems of hacking the SIM and my age old question – why do we still even need a SIM card? Wouldn’t it just be better to store the information in a TPM chip?

    I would like to see NFC take off but I think its current implementation for banking is just crazy, where the NFC will exchange your credit card number, name and expiry information (as shown on Channel 4 news and Panorama) What they should have done is have generated a NFC code (arbitary long 1024 or more bit code) to compliment your credit card number, thus you can’t steal the physical card information via NFC, this would be checked via the banks to the corresponding credit card number.

    Better Mapping

    Through its partnership with Nokia, Microsoft now has access to Nokia’s mapping technology which it has been working on for several years. What this means is that as standard, Windows Phone 8 comes with turn by turn navigation and even better for the developer; offline mapping. To put simply, developers can precache maps and information of an area to be used where there is little or no network signal.

    Were I see offline storage of mapping information being hugely useful is when you take your phone on holiday, you can pre download all the maps of an area and then switch off data mode when travelling.

    These features will not just be accessible via the mapping software but via the mapping APIs. Will be interesting to see how fine grained the control will be over the caching of maps.


    Software engineer. Tea drinker


    Leave a Reply

    Your email address will not be published. Required fields are marked *