When is a reversed string, not a reversed string?

reverseThe .NET framework has a lot classes, with a lot of methods. So many in fact that when certain, obvious ones are missing, it’s a puzzle as to why. One such missing feature is a Reverse method for strings. Taking a collection of characters and reversing them is easy; so why is it missing?

As I wanted such a method, and didn’t want to burden the library I was writing with a disconnected feature, I created the ReversedString nuget package, which supplied it. Job done. Still, why isn’t it included in the standard framework? Experimenting with tests led me to a possible reason. Continue reading “When is a reversed string, not a reversed string?”

SuccincT – A .NET framework to solve unexceptional exceptions & out parameter annoyances

SuccincT iconThe .NET framework is getting on a bit. Many users of the .NET framework are either resistant to API changes, or are stuck with binary-only 3rd party tools that would break with API changes. As a consequence of these two things, the .NET framework has aspects to it that go against modern thinking, but we are stuck with them. The solution to this is often to encapsulate those features within newer frameworks, which offer “best practice” facades on to those features. SuccincT is one such framework. Continue reading “SuccincT — A .NET framework to solve unexceptional exceptions & out parameter annoyances”

Windows 8 and Surface: Microsoft’s do or die moment?

Microsoft SurfaceRecently I haven’t been blogging much as my career took a sudden change of direction and I found myself having to re-learn C# and .NET skills I’d not used for five years, as well as having to catch up with the changes to those technologies in that time. Whilst I like C# as a language, I have been feeling a sense of trepidation over finding myself using such technologies, for I couldn’t see how Microsoft could escape heading down Nokia’s path from dominance to oblivion. The announcement of the Microsoft Surface may have just changed that, but I’m not completely convinced.

Continue reading “Windows 8 and Surface: Microsoft’s do or die moment?”

Microsoft cloud day: great topic; shame about the event

Azure logoToday I headed up to London for what I hoped was going to be an incredible day: a keynote by Scott Guthrie and then a choice of four tracks all crammed with talks on the latest version of Windows Azure. To shameless misquote a cliché, it definitely was a day of two halves. Azure itself looks great and the range of topics available was incredible. The event itself though was a disorganised embarrassment from start to finish. Continue reading “Microsoft cloud day: great topic; shame about the event”

Gestalt: why I now (almost) officially love Microsoft to pieces

gestaltI hate JavaScript. I loath and despise it. I worked as a web developer for a number of years, but I gave it up and moved back to “proper” programming in part because of the growth in AJAX, and thus the need to do JavaScript. Almost exactly a year ago, I proposed the following question be put to Scott Guthrie:

Given the recent announcement that JavaScript 4 will likely never see the light of day, has JavaScript finally outlived its usefulness as the ubiquitous browser language? Is it now time to retire JavaScript, or at least to open up the DOM to multiple languages? The .NET runtime code can be created from C#, Visual Basic, Ruby, J# etc, yet all compile to the same byte code ready to run on the CLR. Likewise these days JRuby, Java etc can all be compiled to the same byte code ready to run on the JVM. Are there any plans to create a JVM or CLR type environment for a future version of IE? Or are we stuck with the inadequacies of JavaScript for years to come?

The question was a suggestion for a question to put to the Speaker Panel at last year’s Remix UK. Whilst I never asked it, it looks like someone at Microsoft has – metaphorically speaking – answered my question in the best way possible. And that answer is Gestalt.

So what is Gestalt, and why my enthusiasm? Gestalt builds on Silverlight to enable web developers to do away with JavaScript within web pages and to replace it with Ruby or Python code using


tags directly within the HTML. As Gestalt uses the DLR, this need not be limited to Ruby and Python either.

Gestalt at the moment is just an early beta, available from the Mix Online Labs. Add to this the fact that Silverlight is only available for Windows and OS X, and JavaScript isn’t quite dying just yet. With luck though, we might see Gestalt take off and spread to Linux and other fringe operating systems. Then we might finally see the death of JavaScript, and it’ll not happen a day too soon in my view.

C# 4.0 is to introduce the static type “dynamic” (and other things)

At Microsoft’s Professional Developer Conference (PDC) yesterday, Anders Hejlsberg unveiled plans for C# version 4.

One of the key changes is the introduction of a new type called “dynamic”. By declaring a variable of type dynamic, the compiler makes no attempt to resolve any of its members at compile time, instead performing late-binding checks at run time. This feature enables C# to use the DLR, and to use DLR-based Python and Ruby libraries.

Another key change, is the inclusion of named and optional parameters. Default values can now be specified for a method’s parameters, and parameters can be specified in any order in a call by using the parameter := value convention to name the parameters. This, combined with dynamic types, suddenly makes COM invocation a lot simpler. For example, the current mess of “ref missing” parameters will just go away.

There are various other additions, such as covariance and contravariance for generics (which I do not yet fully understand). You can read more details of the changes by downloading the document “New features in C# 4.0

If you are eager to try out an early CTP of VS2010, with .NET 4  and C# 4, you can download the 7.5Gb virtual PC image from here.

Release version of Silverlight 2 is due tomorrow

According to a Microsoft press statement, Silverlight 2 is due for release on Tuesday 14th (ie tomorrow). This coincidently is the same day that Apple are due to announce a couple of cosmetic changes to the Apple laptop range, which will have the fanboys wetting themselves with excitement as usual, whilst the rest of the world wonders what the excuse for no Apple Netbook will be this time.

There won’t be any excuses of course as Jobs is rapidly turning Apple into the Microsoft of a decade ago, where the fans lap up any old overpriced and outdated crap thrown to them and the rest of the world despairs over the lack of basic functionality – such as interoperability with non-Apple products – and the right to release software without having to ask permission of one’s overlords. By contrast, Silverlight shows just how far Microsoft has come since those dark days of a decade ago. Silverlight is not just Cross-platform with cross-browser support, Microsoft are working to provide an Eclipse plugin for Silverlight development and the control set (components in Adobe Flash speak) will be released as source code under the Microsoft Public License.

No doubt Jobs announcing that the MacBooks are to get SATA drives to hysterical whoops from the brainwashed will grab the headlines tomorrow, but the rapid march of Silverlight will be tomorrow’s real technology story.

New blog on transaction memory launched on MSDN blogs

Anyone who has had to write multithreaded code will know that one of the big problems with having multiple threads is ensuring that two threads do not modify the same data at the same time, or that one doesn’t read data that is being modified by another. The standard way of dealing with this of course is to use locks. Locks bring problems of their own though, with deadlocks and race conditions being common – difficult to debug and fix – problems.

One proposed solution is transaction memory, which employs the concept of atomic blocks of code that work in a similar way to transactions in databases. In other words, a snapshot of the data state is taken, then a series of memory reads and writes are processed and logged. Finally a lock is taken by the sytem, the data checked and – if no changes outside of the thread occurred – the logged changes are applied. Then the lock is released. If changes did occur, the whole lot is aborted.

Transaction memory has been around for a while, but purely as a research/ academic concept. Today though, Microsoft launched a new transaction memory blog run by the folks in Microsoft’s Developer Division’s Parallel Computing Platform product group. They plan to add an experimental transaction memory model to .NET. Whetehr this will ever go into production is still unknown, but it should be a great blog to watch for further developments in this area.

There have been lots of programming tool updates recently

Flex logoFlash/ Flex

Adobe recently released a RC (release candidate) for Flash Player 10. This adds many nice new features to Flash, such as built-in 3D support, better drawing features, custom filters and effects and – probably most importantly – flash finally gets decent multinational text support.

Adobe also recently released version 3.1 of the Flex API. This update to the Flex 3 API offers support for AIR 1.1, FLash Player 10 and also contains numerous bug fixes.

Finally Adobe have released Flex Builder 3.0.1. This update includes the new Flex 3.1 API and support for Eclipse 3.4.

Visual Studio logoVisual Studio & .NET

Last week Microsoft released .NET 3.5 SP1.This update to the .NET framework offers performance increases to WPF applications, improvements to WCF and support for SQL Server 2008’s new features.

Further, they released Visual Studio 2008 SP1, which includes .NET 3.5 SP1 as well as improved designers for WPF and ADO.NET, new C++ tools and components (including an MFC office ribbon component) and improved JavaScript/ AJAX support.

Microsoft released Silverlight 2 as I predicted. Well actually they didn’t, which meant my prediction was utterly wrong. As they had made a big thing about MBC using Silverlight 2 to provide their Olympic coverage, I expected Microsoft to release Silverlight 2 just before. The reality was very different. Most of the MBC Olympic site runs off Flash and only the video feeds are supplied via the beta of Silverlight 2. Very disapointing.

Will Java show Microsoft the way to .NET 4?

JavaHaving recently started a new job that is Java & ActionScript-centred (as opposed to my old .NET & ActionScript-centred job), I’ve been trying to catch up with the world of Java. Last time I used the latter was back around the turn of the century when Sun hit upon the cunning plan of calling a release both Java 1.2 and Java 2 (a mind-numbingly stupid idea that still continues today with Java 6/ Java 1.6). Things have moved on, the language has had many new features added and the core classes have mushroomed into a huge complex mess that involves a large download. This is of course much the same as .NET, which tends to follow in Java’s footsteps on many levels.

Recently I came across something that Java is soon to offer that .NET would really benefit from: Java 6 SE Update 10. This rather cumbersomely entitled release has the somewhat more snappy title of “Consumer JRE”. This new consumer runtime has a bunch of really nice features, the two key ones in my view are the Java Kernel and draggable applets.

Java Kernel
Like .NET, the Java runtime is a huge download. The first time you try and run a java application on a machine that doesn’t have the JRE installed, in must be downloaded. The Java Kernel is a clever – and oh-so-simple – idea: break the JRE up into lots of bits and only download what is needed. So the first time you run a Java application, the basic – small – kernel is fetched, plus any other parts that the application needs. At that point the application can run. The rest of the JRE is then downloaded in slow-time in the background.

The graph below (from http://java.sun.com/developer/technicalArticles/javase/consumerjre/) highlights this:

Comparison of Various Swing Application Download Sizes With the Full JRE.

Draggable Applets
Back in the days before Flash, Java Applets were the way to do programatically complex stuff in web pages. In recent years, they have declined in popularity, but this feature may bring them back into favour. If you visit a web page and see an applet that you like, then you’ll be able to drag it out of the browser window to the desktop. It then runs as a fully fledged desktop application, rather than just a browser applet.

When these features will be released is anyone’s guess (early betas of the Consumer JRE were “hot news” last year [2007] and it is still in beta), but they are great features none the less. And so this brings me to .NET 4. When Silverlight 2 is released (I’m still predicting late July or very early August for this release, ie just in time for the Olympics), Microsoft will have an obvious starting point for the equivalent of both of these features. The Mono team have their Moonlight desklets, which Microsoft could take and turn into Silverlight applications that can be dragged out of the browser onto the desktop. And the cut-down .NET framework that forms the kernel of Silverlight 2 would make a great starting point for a piecemeal downloadable .NET 4 kernel.

The “big chief” of .NET – Scott Guthrie – is a man who is happy to take great ideas from anywhere and shamelessly add them to .NET, so I fully hope and expect to see such features in the .NET realm sometime soon(ish).