Category Archives: microsoft

Building for multiple mobile platforms with one codebase

Individuals may have strong opinions about the merits of Apple iPhone versus Google Android versus the struggling Palm WebOS versus the not-yet Windows Phone 7; but sit them round a table to discuss app strategy and those diverse platforms change from a debating point to a problem. Presuming a web app won’t cut it, how do you target all those devices without the unreasonable expense and complication of managing multiple projects? The native languages are all different; Objective-C for iPhone and iPad, Java for Android and RIM BlackBerry, JavaScript for WebOS, C# for Windows Phone 7.

There are three possibilities that come to mind. One is that all the platforms will eventually allow you to write in C or C++, making this the unifying language, though you still have some fancy footwork to do overcoming library differences. Android now allows this via the NDK, and Palm via the PDK. There is currently no alternative to Java for Blackberry, and Microsoft says native code won’t be possible on Windows Phone 7, but well, you never know.

The second is Adobe Flash. This is an interesting one, because Apple prohibits Flash on the iPhone, but Adobe has a Packager for iPhone that builds native iPhone apps from Flash projects. Another issue is that although Flash is available or promised for all the main non-Apple devices – Apple’s gift of a selling point to its rivals – it is not Flash alone that does what it needed, but AIR, the “desktop” or out-of-browser runtime. This has been previewed for Android and promised for other devices including Blackberry. AIR for Windows Phone 7? Maybe, though I’ve not seen it mentioned.

A third idea is a clever framework that does the necessary cross-compilation under the covers. This cannot depend on deploying a runtime, nor compiling to native code, because these approaches are blocked by some mobile platforms. Rhomobile has the Rhodes framework, where you code your app in HTML and Ruby and compile for devices including iPhone, Windows Mobile, RIM Blackberry, Symbian, and Android. Rhodes includes an MVC (Model View Controller) framework and an ORM (Object Relational Mapper) to wrap database access. There is also a RhoSync server component to enable offline data with synchronisation back to the server when reconnected; and the RhoHub hosted IDE for buildings apps with a web browser.

Rhomobile tells me that Palm WebOS support is in the works. They also promise Windows Phone 7 support, which intrigued me because Rhodes says it compiles to “true native device applications”. Has Rhomobile gotten round Microsoft’s opposition to native code? Apparently not; VP Rob McMillen eventually told me that this will mean a .NET IL (intermediate language) implementation.

The Rhomobile approach reminds me of AppForge, a company which produced the well-regarded Crossfire add-on for Visual Studio and compiled Visual Basic to a wide variety of mobile platforms. Unfortunately AppForge was acquired by Oracle, and its new owners showed callous disregard for existing customers. Not only did development cease; it also became impossible to renew existing licenses. Thanks to an activation component, that also blocked new deployment of existing applications – every developer’s nightmare.

That said, there is no activation requirement for Rhodes that I know of, and the framework is open source, so I don’t mean to suggest it will suffer a similar fate.

What about Java? On the face of it, Java should be ideal, since multi-device support is what it was designed for. It is a measure of how far Java has fallen that we hear far more about the lack of Flash on the iPhone, than the lack of Java. Microsoft says yes to Flash on Windows Phone 7, though not on first release, but nothing about Java.

Java as a mobile runtime needs a strong dose of lobbying and evangelism from its new stewards Oracle if it is not to fall by the wayside in this context. Hmm, AppForge.

Bill Buxton, Windows Phone 7 hits at Mix10, say attendees

I recall seeing conversations on Twitter about whether it is worth going to conferences, especially vendor-led ones such as Microsoft’s Mix10 which took place earlier this month. It’s expensive, it’s marketing, and many of the sessions are available for free online soon after they take place.

In that context it’s interesting to see some off-the-cuff comments from attendees about what they liked at Mix. Networking comes high on the list, something you cannot get from a distance. There is general boredom with slide-driven presentations, and enthusiasm for interactive panels. One attendee says:

I always find the panels more exciting, and I like the open dialogs where people can ask questions and get real world opinion and advice

As for the content, the name that comes up most often is Bill Buxton, the design expert who joined Microsoft specifically to introduce greater design-consciousness into a company whose track record in this respect is poor. It was a fascinating appointment, and I believe you can see traces of his work in Windows 7 and much more in Windows Phone 7. I talked to Buxton briefly about this and wrote it up here. When I say “his work”, I don’t mean hands-on screen designs, rather a different approach to product development.

Buxton apparently made a considerable impression at Mix10. His session An hour with Bill Buxton (the link has the video) is also one that is interactive, and worth watching if you have an interest in where design fits into the development process. The fact that Microsoft-platform developers are engaging with his ideas is encouraging, given the usability issues that spoil so many Windows applications and machines.

Overall it also seems that Windows Phone 7 went down well – remarkable when you consider that Windows Mobile was all-but dismissed as irrelevant a few months ago – though I did smile at the Microsoft employee (I think) who shows an iPhone with a Mix scheduling app installed. Its special feature: shake the iPhone and it displays a Windows Phone 7 screen, handy if Ballmer appears in the corridor:

image

One final point: an attendee says IronRuby was shown running on Windows Phone 7 in one of the sessions, something I was told elsewhere was not possible.

Windows Phone 7 emulator yields its secrets

So that didn’t take long. Microsoft has made a Windows Phone 7 emulator available to all, explaining that it is a virtual machine running the real device OS. While it works fine for debugging applications, most of the phone UI is mysteriously absent, the exception being Internet Explorer (needed for testing web applications). However, Dan Ardelean has done some nifty work with the emulator image, discovering that a lot more of the UI is present and can be exposed if you make a few modifications. He posted his modified ROM but has since removed it because of copyright concerns. I doubt it will be hard to find.

image

Applications available in the hacked emulator include Mobile Office with Word, Excel, PowerPoint, OneNote and Sharepoint Workspace (undermining Microsoft’s claim that this is only a consumer device), games including a version of Times Reader – full circle for this one, which started out in WPF, moved to Silverlight for Mac, deserted and went to Adobe Flash, and may now reappear in Silverlight – and music/video via a Zune section.

image

My tip to Microsoft: if you don’t want these things to leak, best not put them in the publicly-available image.

Ardelean has also figured out how to amend the native C# port of SQLite, satisfying demand for a local SQL database engine. SQL Server Compact Edition is actually present in Windows Phone 7, but not available to custom applications.

Visual Studio software factories to emerge from Microsoft deep freeze

Last night at the Microsoft Mix party in Las Vegas I happened across Michael Lehman, a senior architect, who told me he had been working for the last six years on a Visual Studio add-on called Feature Builder. This turns out to be the evolution of the very same project which Microsoft’s Jack Greenfield told me about back in March 2007, at an architecture conference in the UK, though back then it had a more exalted status (in Greenfield’s eyes at least) – he described it as a platform rather than merely an add-on. Now Feature Builder is to appear as an extension in the Visual Studio 2010 Gallery, only discoverable by those who seek it out. If enough developers find it and like it, it may end up as part of a future Visual Studio release.

It’s all part of Microsoft’s desperately confused architecture and modelling story. Note that Greenfield in 2007 denigrated the UML:

The UML is a collection of useful abstractions. Unfortunately it’s been peddled as a universal modelling language, but the U never stood for Universal. We subscribe to Michael Jackson, author of Problem Frames, who says that there is no such thing as a universal solution. It’s a childish approach. This is where the Universal Modelling Language marketing pitch fails. UML was never properly extensible. It also has the problem that it was designed by a committee.

So what do we have actually shipping with Visual Studio 2010? Standard UML modelling, the best Microsoft has yet come up with.

Reading between the lines, this likely means that the UML faction within Microsoft outvoted the non-UML faction. However, each release of Visual Studio seems to have its own unique approach to modelling and architecture tools, so it would be no great surprise if Visual Studio 2012, say, replaced them with something different.

As for Feature Builder, it does sound interesting – read the Greenfield interview referenced above for why it has potential. Lehman says it is a simpler approach than previous software factory tools from Microsoft, and named Feature Builder to avoid association with past efforts.

Update: Lehman has blogged about the project here, and you can download the preview here.

Microsoft playing HTML 5 standards game alongside Silverlight game

I’m at Mix10 in Las Vegas where Microsoft has been showing off the latest preview of IE9 – you can try it here, provided you have Vista SP2, Windows 2008 or Windows 7.

The two themes are performance, with GPU-accelerated HTML and graphics and a new Javascript engine that compiles code in the background, and standards support. This latter was not a surprise to me, as I’d heard the well-informed Molly Holzschlag praise Microsoft’s commitment to HTML5 at a workshop here on Sunday – see this earlier post.

During the keynote, we saw IE9 playing a video using the HTML 5 video tag – no Flash or Silverlight needed. Microsoft also showed that in this instance IE9 performed better than Chrome thanks to better hardware acceleration. Although one should always mistrust one vendor’s demonstration of another vendor’s product, it should not be surprising that Microsoft is able to deliver a browser that is better optimised for Windows.

Video, hardware accelerated graphics, audio element support, fast JavaScript: there is considerable overlap with the features of the Microsoft Silverlight (and Adobe Flash) plug-ins.

The plug-in approach has advantages. It offers consistency across browsers, and enables rapid evolution without the hassles of standards committees. The multimedia features in Silverlight and Flash are well ahead of those in HTML 5 – Holzschlag nailed this when she described today’s HTML 5 demos as reminiscent of Flash demos a decade ago.

Still, if you can do without the plug-in you end up with cleaner code, removing the awkward transition between what is in HTML and JavaScript, and what is in the plug-in. There is also a better chance that your code will run on Apple’s iPhone and iPad, for example.

The question though: can Microsoft do an equally good job of supporting HTML 5 throughout its platform, as it will do with Silverlight? This is where I’m doubtful. The Visual Studio and Expression tools will continue to drive developers towards Silverlight rather than HTML 5.

It’s notable that shortly after Microsoft’s IE9 demos at Mix, we saw demos of fun technology like code-name Houston, develop databases in the cloud using just your browser and … Silverlight.

No native code development on Windows Phone 7 says Microsoft – so what about Flash?

Windows Phone 7 is a managed code platform, we’ve been told at Mix10 in Las Vegas. Development is via Silverlight or XNA; there is no native API.

Of course there is a native API; the question is more about what code is allowed to access it. Still, in the press briefing the spokesman was clear that native code development will not be supported.

What about projects like Adobe’s Flash runtime, which both Microsoft and Adobe have said is planned, or at least (in Microsoft’s case), not blocked – although we already know that Flash will not be available in the first release.

All my spokesman would say is that nothing has been announced about that.

My suspicion is that in reality certain privileged vendors will be able to, in effect, extend the operating system with native code libraries. Adobe could be one of those; so too could a company like Rhomobile, which has a cross-compiler for a variety of mobile platforms. So I doubt that Microsoft has yet given us the full story here.

Update: The latest on this is that Microsoft’s Charlie Kindel says that Adobe will have special native access for Flash, but that no other vendor will have that privilege. This still does not make sense to me. Let’s suppose that Windows Phone 7 is a big success. What justification could Microsoft have for supporting the Flash runtime but not the Java runtime, for example? I suspect that Microsoft is chasing the Flash checkbox to one-up Apple; but if Adobe gets native access, others will no doubt follow.

Windows Phone 7 developer story unveiled at Mix10

I’m in Las Vegas for Microsoft’s Mix10 conference, where the developer story for Windows Phone 7 series is being unveiled. According to the press release, the tooling for Windows Phone 7 looks like this:

  • Visual Studio 2010 Express for Windows Phone (free)
  • Windows Phone 7 Series add-in for Visual Studio 2010 RC
  • XNA Game Studio 4.0
  • Emulator
  • Expression Blend for Win Phone CTP

Essentially, you are meant to use XNA for games on the device, and Silverlight for other kinds of application.

Another part of the announcement describes new services for developers – Microsoft Location Service to provide location information, and a notification service to “push information to the phone, regardless of whether or not an application is running”.

Applications will be marketed through a new Windows Phone Marketplace.

I’ll report more details as they emerge, here and on The Register.

Update: Microsoft has added that Expression Blend 4.0, for Silverlight 4.0 support, will be a free upgrade from Expression Blend 3.0.

Silverlight 4.0 RC, Expression Blend 4.0 beta, VS 2010 add-in available for download here: http://silverlight.net/getstarted/silverlight-4-beta/ 

The MSDN documentation for Windows Phone 7 is here: http://msdn.microsoft.com/en-us/library/ff402531(VS.92).aspx

Functional programming, NOSQL themes at QCon London

One reason I enjoy the QCon London software development conference is that it reflects programming trends. Organiser Floyd Marinescu described it as by practitioners for practitioners. In previous years I’ve seen themes like disillusionment with enterprise Java, the rise of Agile methodologies, the trend towards dynamic languages, and the benefits of REST.

So what’s hot this year? A couple of trends are striking. One is functional programming. Don Syme, Principal Researcher at Microsoft Research and co-inventor of F#, gave a lively presentation on functional approaches to parallelism and concurrency. He shows screen after screen of equivalent F# and C# code, illustrating how F# is more concise and expressive, as well as being better suited to concurrent development.

F# is one of the languages included by default in Visual Studio 2010, which should be released shortly.

I asked Syme what sort of problems are not well suited to F#. In his reply he described the state of play in Visual Studio 2010, where you can easily create F# libraries but there is no designer support for user interface code, such as Windows Forms or Windows Presentation Foundation. That is merely a tooling issue though.

Syme’s point is that functional programming, and F# in particular, is ideal for today’s programming challenges, including concurrency and asynchronous code.

If nothing else, he convinced me that every .NET programmer should at least be looking at F# and learning what it can do.

The functional programming track at QCon is not just about F#, of course, though in some ways it seems to be the functional language of the moment.

The other theme that has made a big impression is NoSQL, or what the QCon track calls “Non-relational database managers and web-oriented data”.Geir Magnusson from Gilt Groupe talked about the challenge of running a web site which has extreme peaks in traffic, and where every user needs dynamic data and transaction support so simple caching does not work. They were unable to get their relational database store to scale to handle thousands of transactions a second. They solved the problem with an in-memory non-relational database.

In another talk, the BBC discussed their use of CouchDB for highly scalable web sites.

The Windows Netbook experience: Toshiba NB300

I’ve just received a Toshiba NB300 Netbook, which looks like it will be useful for blogging and web access during a couple of conferences coming up shortly – up to 11 hours battery life, great. I am interested in the user experience when starting out with a new machine, so made a few notes.

I regard this as a critical issue. Microsoft and its OEM partners are up against Apple, a company which pays careful attention to the user experience, from box unwrapping on. Apple charges a premium of course; Windows machines are generally cheaper, and there is an unwritten deal that you put up with a certain amount of foistware and rough edges for the sake of better value overall. On the other hand, if users do not feel good about a product they are unlikely to recommend it to others; Apple has won a fanatical following partly thanks to this attention to detail.

So how was the Toshiba? Better than the Samsung/Vodafone Netbook about which I blogged last month, but still not great.

I switched on and was immediately guided through a registration wizard, being assured that this would activate my warranty. Next I was prompted to activate TEMPRO, a Toshiba service which is meant to send me alerts concerning software updates and so on. I tried to do so, but the activation wizard told me the serial number was invalid, though as far as I can tell it is correct. Next, TEMPRO sent me an alert that my warranty was not registered. You what?

Trying to imagine what a typical user might do, I clicked the Register button just in case. This started up Internet Explorer for the first time. Next, Google popped up a dialog asking me to agree to its privacy policy for the pre-installed Google toolbar. I clicked Disagree and it started uninstalling. In the meantime, IE started its welcome wizard and McAfee started badgering me that I was not fully protected. Here’s my screen a few minutes after first power-on:

image

The problem here is that a bunch of different applications want to get you to agree some terms or set up a subscription, and they are all competing for attention. It is all very predictable, and the end result is ugly. You would think that someone could figure out how to do this in an organised manner.

I took a look at Control Panel. There was a ton of stuff installed although Toshiba is certainly not the worst when it comes to the bundling game. Pre-installed software included the following:

  • Adobe AIR
  • Amazon.co.uk
  • eBay.co.uk
  • Java 6
  • McAfee Security Center (reboot required on uninstall)
  • Silverlight 3
  • Office Home and Student 2007 trial (reboot required on uninstall)
  • Powerpoint 2007
  • Microsoft Works 9
  • Photo Service powered by myphotobook
  • An amazing number of Toshiba utilities – I counted 24
  • Wild Tangent games
  • Windows Live Essentials

I tried Office 2007 trial, which asked to install an ActiveX control to check whether Office 2007 was already installed. This seems a clumsy solution, and perplexing for the user. I let it install, then clicked Buy Now, which got me to a web site where I could purchase it for £86.04.

Microsoft Works 9.0 is also installed in a full version, but whereas Office 2007 has an icon on the desktop, Works is hidden away in the Start menu. It might be all you need on a Netbook, except that its default document formats are unhelpful, if you need to share them with others. Works can open Microsoft’s Office 2007 XML formats (.docx, .xslsx) to some extent, but things went a little awry after I uninstalled Office 2007 trial. Double-clicking a .docx raises a Save As dialog defaulting to .docm, the macro-enabled Open XML format, which is something to do with the Microsoft Open XML Converter. I can’t imagine why it is doing that. Office 2007 will be going back on shortly.

A Toshiba utility called Web Camera Application has an annoying menu which docks to the side of the screen and pops up when you move the mouse there. Since Microsoft has worked hard on the taskbar area, which is where always-on utilities normally live, I’m not clear why Toshiba thinks this is a good idea. Having said that, the similar effort at the top of the screen which handles the Fn keys (known as Flash Cards) is not so bad: mouse activation is off by default, and it shows at a glance what all these keys do. Fn-F8 disables wireless for flight mode, for example. If you want to get rid of the side menu but not the top one, open it and right-click. Uncheck Auto Run and then click Close. If you then want it back, choose Start – All Programs – Toshiba – Utilities – Web Camera Application.

Toshiba pre-installs a multi-function utility called Toshiba Bulletin Board. It includes a Message Center which raises alerts, some of which link to TEMPRO as mentioned above. This turns out to be a bit of a usability disaster too. Here’s what happens. I get a notification that there are alerts to be read. I open Toshiba Bulletin Board and click a hyperlink to open Message Center. It says TEMPRO has some alerts to read, so I click Open. Now I’m in TEMPRO which apparently was not designed with the short 1024×600 screen in mind. It has lots of stuff in a huge dialog, leaving only 1.5 lines of space for the actual message, with a tiny scroll bar next to it. I’ve encircled the message in the pic below so you can see it:

image

This one is a new software driver. Sounds like something useful, so I click Alert Details. This takes me to a web page called Driver Details. It has a big download icon, but clicking that does nothing. The page says:

To download your chosen file, simply click on the filename below.

Curiously, the “filename” is actually a link to an HTML page.

image

I click it. Now I’m here:

image

The IE pop-up blocker is doing its stuff, and if I’m impatient I can click a link. I wait a few seconds, nothing happens, so I click the link.

Help! Now I’m at some kind of portal with four big buttons and no clue which to click:

image

I vaguely recall it was a wireless driver so using my knowledge of acronyms I click WLAN Downloads:

image

Lovely! Now I have a list of around 25 downloads for various operating systems. All I have to do is decide whether my adapter is Intel, Atheros or Realtek, and which version and operating system I require.

Sorry, Toshiba, this is a bad joke. You’ve installed your special utility supposedly to make it easy to keep your product up-to-date, it takes multiple clicks to get anywhere useful, and it is so hopeless that it cannot even select the right driver automatically.

By the way, there is yet another update utility called Toshiba Service Station that comes with an intimidating agreement saying it will keep your data for seven years. I tried that too when prompted; it said No software updates available. How many update utilities does a little netbook need?

While I’m beating up this machine, let me mention the partitioning. The hard drive is only 250GB, but it is divided into three partitions: a small hidden partition for some clever recovery stuff, then two equally-sized partitions one called Windows and the other Data. There’s a case for having a separate partition for the operating system, though I don’t much like it on a Windows client machine because getting the sizes right is a challenge. However, Toshiba hasn’t really done what the names imply. Everything is on the Windows partition, including the data. In other words, the user’s home directory and documents are on the operating system partition. The only thing on drive D is an irritating directory called HDDRecovery which includes a readme pleading with you not to delete it.

Drive D may be handy though – I expect I’ll be trying MeeGo on here soon.

Lessons not learned

I like Toshiba machines, I know Windows backwards, and likely this machine will do a great job for me. Nevertheless, I can see that it has all sorts of usability issues, and that these are mostly not Microsoft’s fault but put there by the OEM vendor.

It beats why there isn’t some kind of usability trial where the prototype is put before a user, who is asked to turn the machine on and, as they say, follow the on-screen directions. The issues are not hard to spot. Toshiba is not a small company; it has the skills and resources to make a machine that offers a pleasing user experience.

It also beats me why resources are devoted to half-baked software like Toshiba Bulletin Board and TEMPRO, which are counter-productive, instead of aiming to integrate seamlessly with the good usability work Microsoft has done in Windows 7.

Why programmers should study Microsoft’s random failure and not trust Google search

The bizarre story of the EU-mandated Windows browser choice screen took an unexpected twist recently when it was noticed that the order of the browsers was not truly random.

image

IBM’s Rob Weir was not the first to spot the problem, but did a great job in writing it up, both when initially observed and after it was fixed by Microsoft.

It was an algorithm error, a piece of code that did not return the results the programmer intended.

Unless Microsoft chooses to tell us, there is no way to tell how the error happened. However, as Weir and others observe, it may be significant that a Google search for something like Javascript random sort immediately gets you sample code that has the same error. Further, the error is not immediately obvious, making it particularly dangerous.

I am sure I am not the only person to turn to Google when confronted with some programming task that requires some research. In general, it is a great resource; and Google’s own algorithms help a little with filtering the results so that sites with better reputation or more inbound links come higher in the results.

Still, what this case illustrates – though accepting again that we do not know how the error occurred in this instance – is that pasting code from a Google search into your project without fully understanding and testing it does not always work. Subtle bugs like this one, which may go unnoticed for a long time, can have severe consequences. Randomisation is used in security code, for example.

As an aside, there also seems to be some randomness in the appearance of the browser choice screen. It turned up on my laptop, but not on my desktop, although both have IE as the default.

And who would have guessed that the EU would arrange for so many of us to get an ad for something like the GreenBrowser popping up on our desktop? Apparently it is the “best choice of flexible and powerful green web browser”, though since it is based on IE it is less radical a choice than it first seems.

image