Had to go home today. Flying on Friday 13th. Can’t see a problem with that. But first a last trip to TechEd.

I could have won this, but in the end I didn’t.

We went to the last session of all, which was a great presentation about using constraints and automated test to improve program reliability. Anyone who has talked to me about programming for more than a couple of minutes will know that I am very keen on Test Driven Development, but it is rather a chore to write the tests, and often you just want to add elements to the code so that the resulting system will not let you make a mistake. If an age can’t be negative why not just have a way of putting that into the code?

.NET Version 4.0 includes Contracts that let you set out things like this, and looks like a great extension to the framework. Find out more here. If you want to write your unit tests automatically you could take a look at Pex which will run your code, watch what it does and then generate suitable test behaviours. It even goes as far as making fake versions of built in library functions to properly replicate a testing environment.

All this is very interesting. I also went along to some sessions on the new dynamic elements being added to C# which let it bind more easily to languages which “make up” typing as they run. This is a great way to knit solutions out of lots of cooperating objects but goes against the grain of a strongly typed language like C#. It seems to me that we are travelling into the future in two directions at once. On one hand we have dynamic systems that fit themselves together as you use them (great for web mashups etc) and on the other we have systems that are strongly typed, constraint powered and properly tested (great for nuclear power stations).

robmiles.com

Rob Miles is technology author and educator who spent many years as a lecturer in Computer Science at the University of Hull. He is also a Microsoft Developer Technologies MVP. He is into technology, teaching and photography. He is the author of the World Famous C# Yellow Book and almost as handsome as he thinks he is.