Spec#, a new dawn for programming languages


Spec# pronounced ‘Spec Sharp’ is new attempt at a more cost effective way to develop and maintain high-quality software. This language is being developed by Microsoft Research and has left me completely dumbstruck. My favourite programming language is C# of which I’m self taught, but I was formally trained in C/C++.

Spec# is an extension to C# that introduces the notion of contract based programming. If you have tried Windows Communication Foundation, you will be familiar with the notion of contracts. Spec# takes things to a whole new level, and is very very explicit – this is a complete understatement by the way.

When you are defining your encapsulated fields and methods you have to go into a great more detail about how those fields and methods will operate, all at compile time. In C++, C# or Visual Basic, a developer usually writes a chunk of code and then compiles that code into a .dll or executable. It is only at this stage when problems are identified, and resolutions are effected. Spec# does not allow this because as you write your code it checks everything. One of the key features is that you have to specify values as non-null. This is a big deal.

What non-null stipulations allow for, is very performant code (‘performant’ is a word used by Technical Fellows so it is now a word – as far as I am concerned). This is because code is not being checked for being null which is something that is always done for Common Language Runtime languages. The way the Spec# team achieve this is through their ‘brain-box’ knowledge of Microsoft Intermediate Language.

I will certainly be keeping my eyes on this one.

Moving over to ALT.NET


Kevin Moore has planted the seeds of doubt in me again. In this article he links to Joel Spolsky’s article Why I Hate Frameworks.

Obviously this is a very popular article, and is very humorous and perceptive. Some perceptions on software do indeed last a long time. I have just read through the white-paper for SCSF and that is pretty heavy going. The example in the white-paper is for a National Bank, with thousands of users and appears vastly over engineered for the purposes which I require. Joel’s article really does resonate once you get to about page 10 of the 50 or so pages.

What does a user for a small to medium sized application, that must perform well and adhere to best practices use? It appears as if there are solutions for the mega problems but non for the mini or micros ones. The .NET framework is increasing the ability for individuals for write far fuller applications, with fewer staff than ever before.

Due to my present and abject disgruntlement, I’ve decided to go ALT.NET, and see if that ‘bears any fruits’. This is something I’ve heard of for some time now, in fact, as bar back as this article. I really am getting rather fatigued at the present state of things and hope things like http://www.castleproject.org/ can help bring about the development ascension I yearn.

Lessons learnt from client facing


Last Friday, I met a prospective client to have a little chat about some problems the business had, what they would like changed to their current system, and what their expectations were.

The meeting went really well, but as is always the case with business, one is not at liberty to discuss various aspects of the requirements process. It may give a competitor insight into current processes, and hence an advantage. Business intelligence is now so important, that most companies are pretty much like a micro version of the Ministry of Defence when it comes to their information and processes.

This was a first for me because I’m usually the back end server guy and not a schmoozer. The meeting went on for over an hour-and-a-half, as we ‘drilled down’ to the requirements process, modelling and analysis. I happened to have had a mock up application prepared, which was excellent because it illustrated my competencies i.e. they could see something that worked, and also a good conceptual springboard. My overall impression was that they were impressed with my demonstration, but I made the mistake of trying to wow them with technical proficiency. I did however make the following observations.

  • At no point was the fact that I was using the latest Office 2007 user interface, and really pretty icons come into the discussion. The points I was grilled about (and it was a grilling) was what was missing. Can you make it do this? Can you make it do that? We are unable to proceed with this unless you address issue x and y and z. This basically mitigated the dichotomy in choosing either Windows Forms or Windows Presentation Foundation.
  • Always make sure when your are dealing with decision makers and senior management to include lots of statistics. I did have a couple of forms with various statistics, but changed the demo around a bit before the meeting just to structure it better and these were missing. The less you have to explain in a meeting and the more you have to show the better. A picture is worth a thousand words and management love statistics. I will be holding secondary meetings and this is an area I will be fully up to speed on. Charting , gauges, etc.
  • Try to make sure that your application is clever, and has features. By this I mean ensure it does as much of the repetitive stuff as possible. Clever insofar as with windows forms for example, the designer does a lot of the tedious stuff like creating a button and aligning it. Features insofar as a mobile phone with a camera, radio, .mp3 player etc
  • It is so important that a user gets predicable behaviour from your components. I had not enabled copy and paste in my data grid view and then one of the users tried to it did not work. Not a big deal, but again I needed to explain why not
  • Don’t include too many half baked features, that throw unhandled exceptions. My demo threw a few of these and it did not look so good. The program crashed and froze and I needed to restart

So all in all not a too exhaustive list but a post I will revisit and hopefully add to.

Stunning open source Silverlight 2 charts


One area Windows Presentation Foundation is leaps and bounds ahead, even at this early stage, is in charting components. The graphical possibilities of WPF/Silverlight are so good, that there really is no comparison. It is what is known commonly as a ‘one horse race’.

Visifire have released their free open source data visualisation charts which are of a very high standard. The best window forms charting suites are either, Devexpress or Dundas but both are expensive (especially Dundas) and still incomparable – quality wise. Component vendors like the aforementioned are going to really have to raise their game, because WPF/Silverlight makes it so much easier for creative people to create visually stunning components.

Why open source software is important


If you want a really sophisticated user interface, with a lot of controls and features, then the prime example is Visual Studio (analogous to an aeroplanes cockpit). The Visual Studio user interface allows for a lot of functionality to be made available in a very limited amount of space, i.e. your computer screen. Space is of the utmost importance, and as your applications grow, and more commands and functionality is added, the more difficult it becomes to navigate. The Office 2007 ‘fluent UI’ or ‘Ribbon’ as it’s more commonly known, solved the key problem Office 2003 had developed, which was it had thousands of commands, and it was near impossible to find the command required easily.

In a previous post, I linked to the apotheosis of UI instruction, and I still continue to extol this Video. Definitely one to watch – I have been thanked numerously for pointing people to it. There is just so much you can learn about what to, and not to do, in your applications.

Whilst rummaging around Sourceforge, I came across this docking control. Yes there are commercial versions available, and have been for some time now, but I had not really realised just what it takes to build such a thing. The controls creator, weifenluo, has done a crackerjack job, and created a real quality control. I have tried a few of the commercial ones, and this is right up there with the best them. One can determine easily and immediately that this was a labour-of-love, just by the way it is structured. I now almost always prefer open source software, because there is so much value as a developer in getting to learn how something works. When one works for software companies, the impetus is almost always on purchasing R.A.D components, and shipping software as quick as possible. While one cannot criticise this technique, if you are a junior developer, or are just starting out, ignore the component vendors and get your hands as dirty as possible. If is far much more important that you know how things work as opposed to know how to configure components in the properties pane. Most of these components shield you from using Interfaces and Delegates which are things one needs to be proficient in, to be an efficacious developer.

9 times out of 10 when creating applications, one is required to produce a solution to a problem that is not available as a purchasable component, or you need to modify the component heavily. One soon finds oneself ‘up a creek without a paddle’ whereas, had one known how the component worked, or had an inkling as to the structure and abstraction before one commenced, speedy procurement of the antidote to whatever the problem that is presented is unproblematic.

Repeater control for windows forms


Visual Basic Power Packs 3 was released about a month ago. I passed by it primarily because of the ‘programming language’ in the title, I am a C# developer through and through. This new power pack has a new repeater control which is very very good. Best of all, is that it is available for both Visual Basic and C# developers in the Visual Studio IDE, despite the Visual Basic title. Just follow the installation instructions and it will add the components to your toolbox.

UPDATE September 2008

The new power packs are now available in the Visual Studio.NET 3.5 SP1, so if you have that installed, then there is no need to download the power pack separately.

How to use the Office 2007 Ribbon Control


The lead designer for the ribbon has this video from mix 08.

I really cannot recommend highly enough just how much you should watch this. Especially if you are using a ribbon control in your application. Jensen takes you on a tour of the prototyping the Office team did, consequently you know when to use the ribbon and in what context it is correct to do so. I have come across a lot of developers who have just used the ribbon ‘willy-nilly’ because it was the ‘new kid on the block’, and resulted in creating a really bad application, from a usability point of view. The ribbon solves one key user interface problem, and understanding what this problem is will result in you creating a better application.

There are lessons to be learned here that mean that even if you are not using the ribbon, just the thought process itself is sufficently edifying. It is fascinating just how bad the Office 2003 user interface is, and the scalability that the ribbon creates for your application. One is left beyond doubt just why Office 2007 is far better than the previous version, with an unimpeachable presentation from Jensen.

The WPF Designer for Windows Forms Developers


As one absorbs the new WPF platform, seasoned Windows Forms developers can find it a little frustrating locating identical functionality in WPF. Typical questions may be, how do I create a menu, or how do I use my custom user control?

Thankfully, MSDN has The WPF Designer for Windows Forms Developers which is a collation of equivalent functionality.

Very useful indeed!

Thoughts on the Composite Application Block


The problem the Acropolis team had, was wanting to create a general purpose UI framework. The plan was to make it easy for developers to just implement the business logic, when designing applications for the line of business market. This was the driving force for Acropolis. What they soon found out, was that you need designers and very skilled ones at that, to create the compelling interfaces, something their budget did not allow for.

This whole area is ambiguous, because you can implement the Model View Controller framework in Windows Presentation Foundation (excellent example here), and using Windows Communication Foundation/Windows Workflow Foundation or ‘Workflow Services’ as they are collectively known, you pretty much get the design pattern alluded to beneath;

You just have the MVC client instead of the integrated/composite view.

You can manage the scalability of your smart/web client either on the client, or at the service level. If you use databinding in windows forms, you can databind the same logic to Windows Presentation Foundation. It’s still the same datasets/table adapters and so forth. It becomes immediately apparent that it is folly to use Language Integrated Query on the smart/web client because you cannot easily swop or use windows forms/WPF/Web clients, because your data access logic is inadvertently tightly coupled with the UI. Until Linq is developed to easily allow for usage in service based scenarios, and you do not have to jump through technical hurdles and cross layer obstacles to get it to work, steer well clear of it.
If however your business logic resides in the service/workflow, or n-tier datasets/stored procedures, you can service all three with very minimal effort. I have an application that is smart client (windows forms) based, but the WCF service can easily ‘service’ a web or WPF client (once WPF stops running like a dog with three legs).

One can then concentrate solely on the creation of an attractive user interface.

A digression is that, SQL server 2008 now has intellisense and a host of features that pretty much allow for the composition of SQL queries as you would in a rich IDE like Visual Studio using SQL Server Management Studio. With the present rage in functional programming (concurrent programming) and SQL being a ‘functional language’, I actually enjoy creating my data access on the server, for all the ease Linq gives. SQL is a purer functional language than C#, and I prefer it. With concurrency being focused on, just the fact that SQL is functional, means that if your data access logic resides on a many core server, the concurrent data crunching occurs on the server, rather than in parallel Linq queries (ad-hoc ‘for’ loops) on the client. This results in an extremely well performing application. WPF/Silverlight can then consume the limited resources of the client machine

Windows Presentation Foundation gathering momentum


As a run-of-the-mill business application developer, one usually pays for presentation layer software from DevExpress/Infragistics and so forth.
Money usually goes to attaining the latest and greatest Office mimicking UI, and your developers ‘thrash out’ the necessary business logic. Rudi Grobler has just posted a simply excellent example of creating an Office 2007 Navigation Pane in WPF, using just the standard WPF tab control. Usually one  would have to spend $200-$400 (without the source code) from – to choose two random presentation vendors –  http://www.actiprosoftware.com/Products/DotNet/WPF/Navigation/Default.aspx
or http://www.devcomponents.com/.
The real beauty here is that one can skin the complete application using the same resource dictionary, which is super-duper-powerful! This allows for a uniform ‘look and feel’ across the application, normally an absolute pain to implement with windows forms.
When you also take into account that Scott Gu recently announced that a major update to WPF is imminent (summer 2008), and that WPF will have a new Ribbon Control and DataGridView out-of-the-box, a personal proclivity is developing toward WPF.

This summers update will address key problems I have highlighted in the past with WPF, primarily poor performance with list type data, and an unavailability of third party controls. If you also ‘factor in’ .NET cold and warm start up times being significantly improved, the WPF ‘stack’ is certainly gathering momentum.