Category Archives: software development

Tube trains show off Windows Presentation Foundation

If you have any interest in .NET Framework 3.0 I recommend this keynote presentation, from Microsoft’s UK developer launch for Vista and Office last weekend. It was given by Sanjay Parthasarathy, Vice president of the Developer and Platform Evangelism Group at Microsoft Corp. He reiterates the themes Microsoft watchers will have heard before: unifying designer and developer, SOA (Service Oriented Architecture), Office as a platform, Enterprise mashups and so on. I’d advise skipping forward to about 38.30 and viewing the presentation given by a couple of developers from the London Underground on their WPF (Windows Presentation Foundation) application for managing the network.

The London Underground is a busy network, clocking up 971 million passenger journeys last year. The WPF app is a real-time visual presentation of its status, based on the familiar tube map. There are “teardrop” indicators which show where there is congestion, technical problems, crime or other incidents. You can click an indicator to open a detailed panel, and dock the panel to get live update. All the data is driven by web services. Everything zooms and drags; you can show or hide specific lines and indicators; and finally there is an amazing 3D view which seems to model the entire system so you can access a report on any part of it with a click. Of course there is an option to see little trains chugging round and stopping at lights; how could this fail to enthuse developers?

The claim is that WPF/XAML combined with SOA makes creating this kind of application much easier than in the past (the whole thing is an XBAP – browser-hosted WPF).

I certainly found the demonstration thought-provoking. This particular case study is a great fit for a highly visual presentation, but to what extent does this also apply to the mainstream business applications that occupy so much developer time? What about the danger of prettification – highly visual apps that are slower and harder to use than the simple GUIs they replace? That app you are working on right now – would it benefit from a WPF redesign?

If you have any insights or comments on the above, I’d love to hear them.

MySpace, Microsoft and scalability

I was impressed when I learned at Mix06 last year that MySpace runs on Microsoft’s platform. After all, MySpace is one of the top 10 busiest sites on the web (currently 6 according to Alexa), and stuffed with dynamic content. So it makes a great case study for Microsoft.

Or does it? The downside of being so prominent is that problems with MySpace reflect badly on Microsoft’s platform. Thus you get articles like Larry Dignan’s MySpace: IT On a Wing and Microsoft Prayer.  

The article Dignan references describes how MySpace has coped, just about, with unexpected and explosive growth. It’s been a ragged evolution, and sounds more like a desperate attempt to keep pace than smooth upscaling. That said, this is more a characteristic of the particular scenario – web site copes with unexpected growth – than a characteristic of the Microsoft platform as such. However it is apparent that 32-bit SQL Server 7.0 was really not up to this level of scalability, and by all accounts even 64-bit SQL Server 2005 is being pushed to its limits.

Two bits of context here. First, the majority of software projects have far more modest requirements than MySpace. Second, there are other scalability examples, such as Microsoft’s favourite case study the London Stock Exchange, which runs smoothly enough as far as I know. Smaller than MySpace, of course, but business-critical in a way that MySpace will never be. On balance it seems that Microsoft’s platform is scalable enough for most of us. That does not mean that it is the best choice, or the most cost effective, or the more reliable. It just means that muttering “it doesn’t scale” is not the potent argument that perhaps it used to be.

Technorati tags: , , ,

The tangled web of Windows Vista versioning and compatibility

There are good reasons why applications may need to know what version of Windows they running on. Some things work differently, such as Unicode on Windows 9x vs Windows NT series; some features may need to be enabled or disabled; or at worst the application may need to close because it just does not work on certain versions of Windows.

Naturally enough, there is an API call for this purpose. Two in fact: GetVersion and GetVersionEx.

Trouble is, they lie. There are three characters in this drama. Let’s call them Nanny Microsoft, Good Developer and Bad Developer.

The problems start with Bad Developer, who writes an app that requires (let’s say) Windows 2000 or XP. These versions of Windows (and Server 2003 as it happens) have a major version number of 5. So Bad Developer writes an app that checks for a major version number of 5. If it is anything else, the app says “Goodbye” – maybe during setup, maybe at runtime, or maybe both.

Enter Nanny Microsoft with a brand new edition of Windows. The major version number is now 6. Bad Developer’s app won’t run, because 5 != 6. Customers are unhappy. No problem, says Nanny Microsoft. The silly Bad Developer should have written the app to check for versions equal or greater to 5. We’ll fix GetVersion so that in certain circumstances it returns a major version of 5 even when it should return 6.

In which circumstances, you wonder. That’s when it gets unclear. Could be one of the compatibility modes. Could be when specific known applications are calling the API. Here’s a past case (not Vista, though I haven’t checked) that gives special treatment to apps called either setup.exe or launch.exe.

So Nanny Microsoft “fixes” GetVersion to lie, Bad Developer’s app works, and everyone is happy.

Everyone that is except Good Developer, who wrote an app that really does need to know the version of Windows. Good Developer’s app is failing because customers are running it on versions of Windows it does not support. Good Developer’s code checks the OS version dutifully, but it gets the wrong result because of the work Nanny Microsoft did on behalf of Bad Developer.

The snag here is that Microsoft can’t introduce an API call like GetRealVersion. If it did, Bad Developer would call it and make the same mistake, and then GetRealVersion would end up dishonest as well.

Is Bad Developer bad?

In reality, Bad Developer may not be happy with Nanny Microsoft either. How can any developer lacking psychic powers know whether or not their app will run on a later version of Windows? Nanny Microsoft is taking a chance here – balancing the desire of customers for maximum compatibility with the desire of developers for maximum safety.

Vista compatibility confusion

Vista seems to have more compatibility switches than ever before. There is UAC (User Account Control) with its registry and folder virtualization, as well as 6 “compatibility modes” for versions of Windows from 95 to 2003, and other settings like “Disable visual themes” or “Run in 640 x 400 screen resolution”.

I understand why these switches exist, yet there is a downside. Developers with apps already deployed have no control over whether users choose to run their apps with or without a compatibility mode, or even whether Nanny Microsoft has done something special just for them.

I recall talking through a particularly mysterious problem with a user on one occasion. This was in Windows XP. Somehow, one of the compatibility modes got switched on for the app that was failing. Naturally the resulting errors gave no clue as to the cause of the problem.

I hope that somewhere in the depths of MSDN is a clear description of what all the compatibility modes actually do.

This application might not have installed correctly

This brings me to a feature of Vista I really dislike. You install an app, and at the end a dialog pops up asking you whether it installed correctly. This happens before you have run it, so the correct answer is, “I haven’t a clue.” Nevertheless, Vista wants you to reinstall with “recommended settings”. What settings? I assume one of the compatibility modes above, but I’m guessing.

I always assure Vista that the app installed just fine. I’d rather troubleshoot specific issues, than have apps install with unkown compatibility switches in operation.

DIY GetVersion

If you are a Good Developer (which I presume), then you know not to trust GetVersion. The official advice is to try not to care about the Windows version. If you need to know about a particular feature, check for that feature. 

Good advice, but what if you do want to know the version? I’ve done a snippet of code for PCW for this, but can’t post it yet. It’s not difficult though, provided you are happy with an implicit “or higher”: find some feature that you know is only on that version of Windows, and check for that.

Is Eclipse adoption peaking?

The rise and rise of Eclipse, the open-source tools platform, is now an old and familiar story. It’s possible though that Eclipse adoption is nearing its peak. I’ve just received issue 43 of the EclipseSource newsletter, which includes the results of BZMedia’s November 2006 survey. Here are some snippets that interested me:

  • The survey is in its third year, and shows Eclipse Enterprise adoption at 54% in 2004, 62% in 2005 and now 67% (the survey says “two thirds”). Still growing, but a flattening curve.
  • The single most popular feature of Eclipse is its low cost (cited by 65% of respondents)
  • By far the primary use of Eclipse is for Java development (more than 70%), despite its support for other languages. In terms of languages, the next most used is SQL at 25% and C++ at 24% (of course these stats overlap).

Although Eclipse clearly still dominates Java development, I’ve picked up some dissatisfaction among developers I’ve talked to at conferences. Some of the complaints are the variable quality of Eclipse plug-ins, difficulty in managing plug-in dependencies especially across a team, and the view that Eclipse is less productive than favourites such as IntelliJ IDEA.

I also note that “free” is not such an unique feature these days, and that the Sun-sponsored NetBeans is winning praise for advances in its Java tools.

Don’t misunderstand me; Eclipse is not under threat. But I would not be surprised to see further levelling off of its adoption curve, or even a small decline in the next year or two.

Technorati tags: , , ,

Using MSBuild from the command line

Now that the holidays are over, here’s some hardcore tweakery for Visual Studio 2005 developers. Visual Studio 2005 includes a completely new build system based on XML build files and a standalone build utility called MSBuild. Visual Studio project files are in fact MSBuild files. Open them up in a text editor and you’ll see that they begin like this:

<Project DefaultTargets=”Build” xmlns=”http://schemas.microsoft.com/developer/msbuild/2003″>

You can also build entire solutions from the command line. Just open up a Visual Studio 2005 command prompt (an easy way of setting up the correct path and enviromental variables), navigate to the project directory, and type:

msbuild yourapp.sln

This is NOT dependent on Visual Studio, since MSBuild is actually part of the .NET Framework redistributable package. This means you can take your project files and build them on machines that don’t have Visual Studio installed, which can be handy for servers.

But what if you want to edit the solution build file? Curiously, solutions are defined in .sln files which are not msbuild files. When you run MSBuild against an .sln file, it actually creates a new in-memory build file for compilation, making it hard to edit.

This is where the tweak comes in. If you define the enviroment variable msbuildemitsolution, then MSBuild generates the solution build file and leaves it there for you to edit. It is given the name yourapp.sln.proj. For the next build, you can run msbuild against this file directly, thus incorporating any manual changes.

Why it works like this, who knows? Still, it’s an intriguing tip and as you can guess I didn’t discover it by accident. I got it from Sayed Ibrahim Hashim’s excellent blog. He is the author of the MSBuild/ClickOnce book Deploying .NET applications. I haven’t seen the book, but I recommend the blog if you want to know more about msbuild; the book is likely good as well.

Technorati tags: , ,

Amazon S3 sample update

When I added background threading to my Delphi S3 sample, I inadvertently broke the ability to connect with SSL. I’ve fixed the problem, and included the necessary openssl DLLs in the download, so you can run this even if you don’t have Delphi. I use it to backup my own files.

Amazon S3 is a web service for storing files on the internet. It works well and is good value compared to most online storage services.

The distinctive features of this sample are first, that it is Delphi, and second, that it is native Win32. Most of the samples out there are for Java, .NET or scripting languages.

Technorati tags: , ,

Farewell to consistent UI on Windows

Dare Obesanjo says 2006 is the year Microsoft gave up on consistent UI. It’s a follow-up to a post by Mike Torres in which he identifies inconsistencies in various new apps from Microsoft this year. One thing they all have in common is that traditional menus are deprecated, either hidden by default (IE7, Windows Media Player 11) or not available at all (Office 2007).

The reason this is happening is the influence of the Web. The Web gives designers a lot of freedom over how applications are designed, especially in conjunction with Flash. The Web also forces app developers to find some alternative to the traditional menu bar, since it has a page model rather than a window model. Standard desktop apps with File and Edit menus now look dated.

Microsoft has embraced the new designer religion, with the innovative Office 2007 UI, the Expression range of designer-oriented tools, and the Windows Presentation Foundation which gives far more freedom to UI designers.

Nevertheless, Microsoft has slipped up here. The differences that Torres identifies are bewildering to users. I predict that the company will settle on some specific approach (probably the Office ribbon) and try to enforce it throughout. Visual Studio with a ribbon UI?

It means developers have a tricky choice to make with new applications. Broadly:

  1. Stick with tried and tested menus and toolbars until things settle down.
  2. Adopt the ribbon, facing the sign-or-don’t-sign dilemma.
  3. Do your own thing, after all everyone else does.

For an in-house app I’d suggest (1). Menus and toolbars work pretty well, everyone knows how to use them, and most important, it is a lot less work. Further, when non-designers try to take a design-centric approach, the results are invariably ugly.

Technorati tags: , , ,

Bugs in IE7 RSS platform?

I welcome the introduction of the RSS platform in IE7; I think a central repository for RSS feeds is a great idea, even though Outlook’s RSS integration strikes me as totally broken

But is it reliable? I was using it to browse Jensen Harris’s excellent blog and noticed that the entries were from somebody else. A look at the feed properties reveals all:

It appears that the RSS store had somehow zapped the blog, but kept its title attached to a different feed, Bruce Schneier’s security blog as it happens.

I don’t think I have much hope of discovering why this bug occurred, unless someone from the team would care to comment, but it does cast doubt on the RSS store’s reliablity. Or could it be a problem with my blogreader app? The only time this writes to the store is when it marks a feeditem as read, which it does by setting the IsRead property on a FeedItem reference. Strange.

Technorati tags: ,

Free preview chapter of Adam Nathan’s WPF book

Some of you will know Microsoft’s Adam Nathan as the author of .NET and COM, still the best book available for drilling deep into the way .NET interops with native code. He’s now written a guide to the Windows Presentation Foundation, one of the key components of the new Windows API. I’ll be reviewing the book in due course, but in the meantime the publishers have kindly given permission for me to offer a free chapter to readers of this blog.

Download Chapter 3, Important New Concepts in WPF [PDF].

Chapter 3 covers WPF logical trees, dependency properties, routed events, commands, and the overall class hierarchy.

If you like the book, you can order it here:

Nathan: Windows Presentation Foundation (US customers)

Nathan: Windows Presentation Foundation (UK customers)

Technorati tags: