Category Archives: software development

UI design patterns for Rich Internet Applications

We are used to the idea of design patterns for software construction, following the great work of the gang of four – Design Patterns: Elements of Reusable object-oriented software by Erich Gamma, Richard Helm, Ralph Johnson and John M Vlissides. But what about patterns for user interface design? What about learning standard UI patterns and how to apply them well, so that you have an immediate head start when sitting down to create a compelling and usable application?

Ryan Stewart’s blog post on up-leveling the Flex User Interface Discussion links to the work of Theresa Neil, who spoke on Designing Rich Application at the DelveUI conference last week. She’s posted her slide show, which I’ve also embedded below:

I found it fascinating, and while I will never be a designer, this kind of methodical, structured approach to building a UI is one that developers can also appreciate.

She also has a matrix of essential controls showing which UI frameworks support them – page 21 above – though the slide only shows controls from A to D; the full set is described here.

While I’m on the subject, there’s also a thought-provoking post from Brandon Walkin on managing UI complexity. It seems Microsoft can still provide plenty of “how not to do it” examples.

C#-SQLite now published

Noah Hart has published his port of SQLite to C#. The project is called C#-SQLite. The main SQLite author, D Richard Hipp, originally said that the project should not include SQLite anywhere in its name, but has now relented:

I think I would be comfortable with a name like C#-SQLite. The prefix makes it clear that it is a reimplementation, not the original. People notice prefixes much more readily than suffixes. There is also precedent for changing a prefix for a reimplementation. Lucene, for example, was ported to C-Lucene. I’m sure there are others.

The whole point of this exercise it to avoid confusing people. Folks who use C#-SQLite need to be fully aware that what they are using is distinct and separate from the original SQLite. As long as that one condition is met, I am happy.

I downloaded the code, compiled in Visual Studio 2008 (requires project conversion), ran the shell and tried a couple of commands. It works!

Of course there are already a million ways to use SQLite from .NET, but they all require platform invoke to native code, which is not allowed in some scenarios for security and/or cross platform reasons – Silverlight being a prime example.

Next question: how hard will it be to get this working in a Silverlight project?

See also SQLite C# port raises hopes for a Silverlight local database manager which has some early performance results.

Technorati Tags: ,,

SQLite C# port raises hopes for a Silverlight local database manager

Yesterday programmer Noah Hart announced a port of SQLite to C#:

I am pleased to announce that the C# port is done to the point where others can look at it.

Unfortunately the code was taken offline almost immediately afterwards, thanks to the intervention of the author of SQLite, D Richard Hipp:

Noah, you are welcomed, even encouraged, to take the source code to SQLite and translate it in any way you want and do whatever you want with it. But you need to make it abundantly clear to everyone on your site and in the comments of your source code that your code is not the original SQLite … SQLite is a registered trade mark. If I don’t defend the trademark, then I could lose it. So, I really do need to insist that you not use the name "SQLite" for your product.

The reason given is that Dr Hipp does not want to receive support requests for the port, though the intervention is a little surprising since there are other 3rd party adaptions out there that do use the SQLite name, though these generally modify or wrap the original code rather than porting it completely.

Still, Hart has taken it in his stride and it looks as if the code may be back soon under the name sqlsharp – a Google code project with that name has been created. I hope this is the name since I suggested it, though it is rather an obvious one and I might not have been the first.

Why the interest? First, it’s always interesting to compare languages. Currently, Hart says his executable compiles to 528kb vs 506kb for the native version, and performs 3-5 times more slowly (results in rows per second):

Test SQLite3 C# SQLite3
Inserts 300K 1300K
Selects 1500K 8450K
Updates 60K 300K
Deletes 250K 700K

Although that may seem disappointing, SQLite is remarkably fast so even 5 times slower is still acceptable in many contexts; and there are no doubt many possibilities for optimisation.

What’s the point? Hart says it was a C# learning exercise, which is fair enough. Others are hopeful for a local database manager for Microsoft Silverlight, writing to isolated storage. Competitor Adobe AIR includes SQLite in the runtime, as does Google Gears.

Silverlight may a stretch for Hart’s port. Silverlight does not allow platform invoke or code marked as unsafe; and while there are apparently only a few p/invoke calls I’m guessing there may be many unsafe sections since the original SQLite makes heavy use of pointers.*

Although Silverlight is an implementation of the .NET Framework, it does not include the System.Data namespace. It does include System.Linq.

There are a few other efforts at creating a local database manager for Silverlight, including McObject’s Perst, db4o (work in progress), and Silverlight Database which works by persisting XML.

*Update: the project has now been published as csharp-sqlite, which is an excellent name; it looks as if Hipp relented to some extent. Now that I’ve seen the code I find I’m wrong about unsafe sections. In fact, I added C#-Sqlite to a Silverlight project and it failed to compile with a mere 53 errors, many of them related to file locking – possibly less necessary in isolated storage? A Silverlight port looks feasible.

After Microsoft deal, what next for Yahoo’s developer platform?

In May I attended a Yahoo Hack Day in London and wrote it up for the Reg. Although I found the business story unconvincing, I was impressed by the technology – things like BOSS, SearchMonkey, and especially YQL (Yahoo Query Language), which lets you treat the entire Internet as a structured database.

One thing all these services have in common is that they are search-related. If the Microsoft-Yahoo deal goes ahead, responsibility for Yahoo’s search engine moves to Microsoft. My high-level understanding is that Bing becomes the search engine, with some Yahoo engineers possibly moving to Microsoft, and others being let go.

There are big implications for Yahoo and the developers which depend on its services. Here’s the official statement quoted by Ashim Chhabra on the BOSS team:

This is the beginning of a process and we’ll be working with Microsoft to determine what makes the best sense for both us and developers. Regardless, we are certainly committed to continuing to innovate on the user experience of search all across Yahoo! and on continuing to engage with the developer community on several fronts, opening up leading audience experiences and data to third-party innovation. In that context, SearchMonkey can add a lot of value to how we help people get the most out of search and out of Yahoo!. Over the next several months we’ll determine what makes sense with our developer offerings and provide information when available.

though Chhabra adds:

Honestly the team is still absorbing the implications and we just don’t know. We can tell you that BOSS will remain live for the time being. There are many aspects still to be considered. Over the next several days we’ll be working hard to get clarity and will update the community as soon as we can.

A reasonable guess is that the APIs will continue to work – it is not usually that hard to map one set of APIs onto another – but that the focus of the development effort will change, and the actual results will be different when based on the new engine.

Bing’s engine is not bad, as one developer observes:

Do not take me wrong, have been using the Bing API since 2.0 and find it very similar to BOSS for integration purposes and results are good, but I guess my point is that Yahoo! Search Technology is pretty much dead from my understanding and hence the "real" BOSS is dead too.

There is another problem though, which is that the Yahoo culture, which draws on open source (Yahoo runs largely on PHP), is different from that of Microsoft. Some developers who use Yahoo APIs will likely feel uncomfortable with moving to Microsoft’s Live platform – prompting comments like this one:

Don’t use Bing please please please please please

Such folk may well find Google more congenial. Google’s search engine is far from open source, but the company supports a large amount of open source code (not least its web browser, Chrome/Chromium) and has been more successful than Microsoft in engaging with the open source community.

Although I suspect Yahoo gets little direct revenue from its developers, they are a dangerous group to disrupt, because of the influence they wield. If the Yahoo platform loses momentum, it is likely to impact its other initiatives as well.

Update:

See also this announcement:

For SearchMonkey and BOSS, we currently do not have anything concrete to tell you. Clearly, we’ll need to work with Microsoft to determine what makes the most sense for you and for us. For more details, please see Ashim Chhabra’s post to developers on the Yahoo! Search BOSS group. We’ve also received questions about the future of Yahoo!’s other developer offerings, such as YUI, YQL , and Pipes. We wanted to let you know that today’s news does not affect these products.

Morgan Stanley: why we didn’t use Silverlight for Matrix

I attended an online briefing about Morgan Stanley’s Matrix [warning: lots of Flash with sound effects], a tool for financial trading which has been written in Adobe Flex.  Adobe’s Andrew Shorten has more information here, and notes:

Matrix was developed by Morgan Stanley with user experience consultation from Adobe Professional Services and technical delivery by Lab 49 in partnership with Adobe Professional Services and others.

Unfortunately I missed the first part of the briefing thanks to streaming issues (I wasn’t alone), but things settled down after 15 minutes or so. Hishaam Mufti-Bey, Matrix founder and global director at Morgan Stanley, spoke about the application and the technology it uses. He emphasized the value of zero-install:

The technology is out of the way, no-one has a problem with running the application. It’s now about how tight our prices are, how good our content is, which is always what we wanted to have happen … we want to deliver our franchise to the client without taxing their systems, or having to get past firewall issues, or install software and IT security will get in the way and it takes months to deploy.

I couldn’t agree more. The app itself looks great, though details of how it works were sketchy, I guess for commercial reasons. We were also told little about the server side of the application. Performance is said to be good, despite what is apparently 600,000 lines of code (I’m not 100% clear if this is all Flex code running on the client):

We’ve seen up to 40 currency players running on the screen and getting up to about 400 updates a second

claimed Mufti-Bey, though he added later than lack of multi-threading support is an issue. Next, he took a pop at Microsoft’s Silverlight:

Going out to clients and not installing software, that is a major show-stopper for Silverlight. If Silverlight turned around and offered that one day, that I didn’t need to install stuff on the client’s PC, then it would be a head-to-head. Flash is on 97.7% of the world’s browsers. That was a major consideration for us.

It’s an interesting point, though I’d have thought his comments need some qualification. Flash and Silverlight are both browser plug-ins, so the install issue is similar: if the plug-in is already installed, the app will just run in the browser, but if it is not installed in the right version, the user will need to install the plug-in first. According to riastats.com Flash is up to about 74.5% for version 10 and 20.5% for version 9; I’m not sure if Matrix requires version 10, but if it does then Mufti-Bey is exaggerating a little. Matrix currently uses Flash 9 (see comments). Silverlight by contrast is on 30% for version 2 and 1% for the just-released version 3.

Installing a browser plug-in is easy for most of us, but in a locked-down corporate environment may be problematic, and there is always some percentage of installs that will be troublesome. I’ve found installing Silverlight a smooth and quick process; but undoubtedly Flash is a de-facto standard whereas Silverlight is not. Microsoft can only address this by persuading more of us to develop Silverlight apps, and using it more in its own sites and products – like the forthcoming Office 2010 web applications, for example.

Still, the need to install the Silverlight plug-in where necessary is far less burdensome than either a classic Windows setup, or a requirement for the full .Net Framework; and Microsoft has also removed the requirement to run Windows itself by supporting Intel Mac. It sounds as if Microsoft is going in the right direction, even if catching Flash is a tough challenge.

That might not be enough, according to Mufti-Bey. Asked about the importance of designer-developer workflow, he remarked:

You have to look at the people that use that technology. The design community. That’s the biggest problem that Microsoft has. The designers all carry around Apple laptops, they all use the Photosuite [sic] set of software tools. It’s like asking structural engineers to stop using CAD applications. That’s the tool that they use, and if you can’t convince them to switch away from your software suite you are going to get a limited number of designers that will use Microsoft’s toolset … if you can’t get the designers to switch, to learn a new language, then how can you possibly ever get some traction?

Well, it wasn’t the answer to the question posed, but an interesting point nevertheless. Let’s presume that he is right, and nobody will switch from Photoshop. Is it so hard for Mac-wielding designers to work with .NET developers? There must be something in it, bearing in mind the effort Microsoft has made to improve Photoshop import in Expression Blend 3.0.

Overall I would like to have heard more about the process and challenges of developing a large Flex application, and less about why not to use Silverlight, interesting topic though it is.

Microsoft reports weak financials, still failing in the cloud

Microsoft has reported weak results for the quarter ending June 2009.

Here’s a table which breaks down the results vs the same quarter last year, similar to one I made for the March figures. Numbers are in $millions:

Client Revenue % change Profit % change
Client (Windows) 3108 -28.7 2167 -33.32
Server and Tools 3510 -5.67 1349 -1.46
Online 731 12.66 -732 -50.93
Business (Office) 4564 -13.33 2816 -16.17
Entertainment and devices 1189 -25.22 -130 -23.98

I am ignoring the hefty $1483 loss on “corporate-level activity” – though I noticed that despite announcing a projected reduction in headcount of up to 5000 by June 2010, headcount actually increased by 2% (around 1800) in the last 12 months.

Grim figures, though given the recession and that Microsoft still reported profits of $3987 for the quarter, not cataclysmic.

I expect Windows 7 will be a success and that the figures there will improve; further, if the global economy recovers (about which I am sceptical but ignorant) Microsoft’s results will no doubt reflect that. If Windows 7 does succeed, it will have spin-off benefits for other products.

Nevertheless, the company should be worried. Although we are not going to be abandoning our PCs and laptops any time soon, it doesn’t take much insight to predict that increasingly powerful internet-connected devices will tend to reduce the number of traditional computers we need, which will impact Office as well as Windows. On the server side, cloud computing will dampen demand for servers, particularly in the small business sector where Microsoft is particularly successful.

The challenge for Microsoft is to counter those trends by growing its online business, but that is not happening yet. Mobile is another potential growth area, but the figures for entertainment and devices show that Microsoft is not exploiting it successfully.

Further, if online does grow, that will damage the partner ecosystem which thrives on delivering and maintaining on-premise Windows and Office.

Right now it’s hard to disagree with Robin Bloor’s prediction of an Incredible Shrinking Microsoft.

This could change; but only if that awkward third line in the table above undergoes dramatic transformation. Although there are signs of life, with promising technology like Azure and Silverlight, I am not yet convinced that Microsoft is even aware of its predicament, though with results like these it will be soon.

Death of Popfly shows the dark side of the cloud

I am not sure what goals Microsoft had for Popfly – or whether the company itself knew them – but apparently they were not met; a week ago the team announced the closure of the service, with just one month’s notice:

Unfortunately, on August 24, 2009 the Popfly service will be discontinued and all sites, references, and resources will be taken down. At that time, your access to your Popfly account, including any games and mashups that you have created, will be discontinued.

If this is a sign of a new clarity of focus at Microsoft it may even be good news, but not for those who invested time and effort in creating Popfly content.

Popfly had several aspects. It was a tool for creating mash-ups, web applications that combine data from several Internet sources; it was a game creator; it was a cloud-based IDE; and it was a visual programming tool. It was the last that interested me most. True visual programming means that program logic as well as user interface is created visually. It has never really hit the mainstream, though it is an idea that will not go away. A recent example is found in Expression Blend 3, another Microsoft product, which allow designers to add simple logic to Silverlight or Windows Presentation Foundation applications without writing code.

One day, most programming may be done this way; but not with Popfly, despite its potential and promise.

The other reflection on this modern form of software abandonment is how it highlights a risk inherent in cloud computing: what happens when your platform is removed. Software abandonment is nothing new, and most of us will recall a favourite word processor, mind mapping tool, database manager or some other utility which was chopped. In the old world though, you could still use the software, at least until an operating system upgrade came along and rendered it useless. Even that can often be overcome, thanks to virtualisation.

Not so with cloud computing. When the Popfly service closes, you simply lose access to all your work – though informally the team has stepped in with a downloader, so all is not lost.

Technically the same thing could happen to Google Apps, Salesforce.com, Windows Azure, Amazon web services and the rest, though the chance of these large concerns with millions of users (Azure aside) closing suddenly is tiny. The death of Popfly is nevertheless a warning: if your cloud computing service is either delivered by a small concern, or is of small concern to a large concern, the risks of data and service loss are very real.

Silverlight 3 is out

Microsoft has released Silverlight 3, though some pieces of the platform are still not done – it seems there is always something to wait for.

There are links to the tools developers and designers need to install here:

http://silverlight.net/GetStarted/

Note that Expression Blend and Sketchflow are still at Release Candidate stage.

The .NET RIA services, a server-side piece that simplifies authentication and database operations, is available in a new July 2009 preview:

http://www.microsoft.com/DOWNLOADS/details.aspx?FamilyID=76bb3a07-3846-4564-b0c3-27972bcaabce&displaylang=en#filelist

See this excellent post by Nikhil Kothari for more on RIA Services – it’s from March but does a good job of explaining what they are about.

Using Silverlight 3, or plan to? I’d love to hear from you, along with your views on what is best and what is worst about Microsoft’s RIA efforts.

Symbian appeals to Traveling Geeks: develop for our platform

I attended a Traveling Geeks event in London last night, a party sponsored mainly by Symbian and NESTA. I returned with a large pile of business cards from folk involved in a diverse range of initiatives. Kate Arkless Gray told me about Save our Sounds, a BBC World Service project to archive and map interesting and endangered sounds from around the world; while Sarah Blow sought to convince me that I don’t just need Twitter, I need Tweetmeme to track what is happening on the world’s most public short message service.

Digitrad wants me to sign up for yes.tel, which means registering a .tel domain with its service and using it as a public home page, email address and voicemail box. It’s not clear to me what advantage it has over all the other third-parties who want to own my digital identity, except that Digitrad is smaller and therefore less threatening than Google or Facebook. I’m happy with conventional registrars.

From my perspective, Symbian managed to dominate the event with engaging images around the walls and numerous representatives to talk up its mobile platform. The Symbian story is an interesting one. Originally developed by Psion, it was spun off in 1998 into an independent company co-owned by the giants of mobile at the time: Ericsson, Nokia, Motorola and Psion itself. Nokia proceeded to acquire more and more of Symbian, achieving greater control but also – it seemed to me – reducing the chance it once had of becoming an industry standard. Other vendors became wary of depending on an operating system controlled by a competitor. Linux had greater appeal – as seen in both the Palm Pre and Google Android – while Apple did its own thing with OS X on the iPhone, and Microsoft ploughed on with Windows Mobile.

Last year Nokia responded to the pressure by announcing plans to acquire Symbian in its entirety and then to give it to a new Symbian Foundation, an open source, collaborative project along the same lines as Eclipse. Developers can sign up to get the tools for programming Symbian applications in C++, Java, Python, Ruby, Adobe Flash, C# or HTML/JavaScript. I was told that Symbian intends to be even more open than Android. It restores Symbian’s cross-industry potential though there is now more competition.

Should you develop for Symbian? The Symbian Foundation is a great move, but in the App Store era I suspect deployment issues are even more critical than the quality of the OS or its development tools. Developers will go where they can find customers. Apple is reaping the rewards of controlling the entire platform and marginalizing the mobile operators.

Still, as long as Apple is content for the iPhone to be punishingly expensive, it leaves space for others. The appeal of Symbian will depend not only on its success among device manufacturers, but also on how easy it is for users to find, purchase and install applications.

There is also the matter of reliable, fast and affordable internet access, the lack of which has so far spoilt every mobile device I have owned.

Clipboard.Clear … oops

Bob Warfield is upset because he lost some work. He copied some text in Live Writer, deleted it, then opened Word and tried to paste. No go .. clipboard empty.

Frustrating, but is he right to call his post Microsoft: Bad User Experience Is Cultural, on the grounds that Word is designed to clear the clipboard every time it opens?

Here’s a bit more information. First, Word does not do that here. Second, if it weren’t that I do equally silly things I’d suggest that it is always risky to entrust the clipboard with your work without a backup.

That said, I can understand why Word might appear to clear the clipboard on start-up. It could be a bug, or it could be an add-in of some kind. The thing is, it is really easy to clear the clipboard in code. Just call EmptyClipboard and you’re done. There are ways to do it in VBA too, via a DataObject, or in .NET via Clipboard.Clear.

As Warfield’s case shows, clearing the clipboard in code can be deeply user-hostile. Should Windows prevent it? Difficult, because if your application or add-in implements clipboard functionality, it is the correct thing to do when the user selects Cut, Copy or Paste.

Lessons? A warning, I guess, not to use the clipboard for any purpose other than a user-initiated clipboard action – though I guess it can be tempting if you are hacking some sort of inter-process data exchange.

Second, when Windows lets you down it is not necessarily Microsoft culture to blame. There is an argument though … applications that don’t conform to Windows guidelines are a big problem and without them things like User Account Control might not need to exist; and that is Microsoft’s fault in a way, because of the history of Windows, its changing guidelines, and the inability of even Microsoft to stick to them in the past. Maybe Microsoft is partly to blame for the wild culture of third-party Windows apps.

This is a blog entry rather than a comment because Warfield’s blog needs registration to comment, and I am allergic.