beta code programming

MSDN roadshow 2008 : Glasgow

MSDN roadshow for slides and details.

I attended this event last week, but I’ve only now had the time to write about it, so I hope my notes are up to scratch. Overall impressions were that it was definitely an advertising event, and so less useful than community-focused events such as the Developer, Developer, Developer event (which I’m getting tempted just to call d3) but there was some useful information in the talks. Not sure if or when I’ll get the chance to use them properly but here’s my thoughts on the technologies. If I make any mistakes, feel free to correct me and I’ll edit this content, but make sure you check out the slides above or on the speaker’s sites as they’ll be more accurate.


Mike Taulty

This is Microsoft’s answer to abstracting the database layer. ADO previously got as far as abstracting the connection, whilst leaving provider-specific SQL embedded in the code. The new version has two new abstractions which build on each other, which together make up the entity framework. At the basic level is a new SQL variant ESQL (entity SQL) which abstracts out the underlying database language to a more .Net-friendly variant that returns objects rather than rows. On top of this is built ADO’s LINQ-compatable ORM that allows LINQ queries to run against any ADO database provider.

To make this work, ADO.Net uses XML config files like NHibernate to map between the database schema and the object schema. Unlike NHibernate, ADO.Net adds XML definitions of both the database and the object schema. (Wouldn’t it be nice if databases had a schema we could access from code, eh…?) ADO.Net then uses the object schema to generate .Net classes like LLBLGen. These partial classes support LINQ and some extension via methods, but cannot use properties as these are lost whenever the classes are re-generated. The sample code provided in the talk discussed an ugly hack where a metadata class containing properties was associated with the generated partial class via decorators. It works, but it’s hardly as easy to use as partial classes generated by, for example, Visual Studio’s GUI designer.

Apart from ORM, the new ADO.Net also provides Data Services, which allows CRUD database access via RESTful URIs, which is an alternative to embedding SQL in your URLs, if you don’t fancy putting too much abstraction between your website and your database. Data Services has also caught the LINQ bug, making queries through web services easier, and providing an alternative access method to the standard SOAP approach favoured by many exisiting web services.


Mike Ormond

Web 2.0 and AJAX may make for more responsive web pages, but they have a habit of breaking expectations, such as the behaviour of the back button, which won’t undo incremental changes since AJAX applications tend to perform in-page loading that doesn’t update URLs. Google and Yahoo both have toolkits that help with this, and now Microsoft’s ASP.Net extensions add state data to ASP.Net apps.

ASP.Net also supports routing tables to de-couple the web hierarchy from the disk hierarchy, which is useful for tagging, RESTful URIs and other behaviour, but was developed in ASP to provide an MVC framework for the web, in order to provide cleaner code and a simpler URI interface.

The preview edition is in a lot of flux, so I’m not sure what state it’s in a week on from the roadshow, so I’d suggest catching up with the blog above for the latest information.

Silverlight 2

Daniel Moth

aka Silverlight.Net. You can now use .Net languages to script Microsoft’s flash killer, which is definitely cool from an IronPython perspective, although it is a strict sibling of .Net (think J2ME vs Java). The really interesting parts of Silverlight 2 are in the fact that there is now full 2-way communication between the web page hosting the silverlight app and the app itself, and that Microsoft is now planning a designer’s studio for Silverlight to do the GUI and the animations. How long before all apps are written partly with the XAML-based Expression Blend? If you think there’s a lot of variety in interfaces right now, I can see a lot more variety coming once designers get their hands on Blend.

Visual Studio Team Suite

Neil Kidd

Anyone who’s not using unit tests and refactoring to improve their code is not a professional programmer. The new features in VSTS aim to bring the new version up to compete with the other testing and refactoring tools out there. Continuous integration and testing were covered at d3, but this talk explored the idea that CI can include any task that can be represented as a .Net object, and there are a number of such tasks available from the contrib server including tasks to deploy a database or set up a virtual server ready for a test environment. The CI mantra was pushed with the comment that Flickr have a 30-minute release schedule so that users are always up to date with new features and bug fixes. It’s a lot easier to do that on a website than with deployed software like Windows, but it’s a good thing to keep in mind when setting up CI. It’s nice to be able to prove that the software is ready to go whenever you need it.

The part that most interested me about the new VSTS was the addition of unit testing, refactoring and source control to SQL Server databases (with a promise of other dbs to follow). The source control was fairly straight-forward, one SQL file for each table, key, constraint, view, procedure, etc, laid out in files to match the heirarchy of the database in Management Studio, so you can track changes at a very fine-grained level, so long as you’re using something a bit more advanced than CVS. Once the schema is imported, refactoring options such as wildcard expansion in SELECT queries becomes available to provide more robust code. Unit testing of SQL stored procedures, using SQL conditions such as row counts and performance measures have been added, and the unit tests are run as transactions to prevent any changes to the database. The testing framework also includes performance and load testing, web testing that allows testing of a sequence with captured data, and a data generator similar to the one demonstrated by Redgate at d3.

Technorati tags: , , , , , , , , , , , , , , , ,

Blogged with Flock

Blogged with the Flock Browser

Tags: , , , , , , , , , , , , , , , ,

code programming

Developer Day Scotland Review

Developer Day Scotland > Home

Here’s a quick summary of the talks I attended and what I thought, will a little help from the twitter hashtag for developer day scotland.

Web Client Software Factory

The first talk I attended was an excellent overview of the Web Client Software Factory by Gary Short. He was brave enough to give a live demo, and was the only presenter to type longhand, with spelling errors and all, like a real programmer 😉 The Web Client Software Factory itself looks interesting, although I’m not sure if I’ll have much use for it myself in the short term. The basic concept is to provide a common platform so that multiple devlopment teams can create web-based applications around a single architecture, so the factory packages up all the database, logging, look-and-feel and other functionality into a visual studio project that developers can then use as the basis for their development, saving them the repetitive tasks that are the plumbing behind the application rather than the business logic that forms the application requirements.

Transaction and Error Handling in SQL Server

The second talk was about Transaction and Error Handling in SQL Server by Martin Bell. The talk started off a little uneven, but given the wide range of topics that had to be covered to introduce the subject, I can’t criticise that too heavily. Once he started discussing best practice and worked through examples of error handling code, it was clear he was a lot more comfortable, and it was an interesting talk. There was a lot of criticism of what seems to have become standard practice amongst some programmers, which is to ignore return values rather than check for errors. I’m sure part of this is due to the fact that many code samples leave these out for clarity, and there is little recognition that this should be recognised as bad style. SQL Server 2005 helps alleviate this somewhat by adding exceptions, which can’t just be ignored (although a catch-all is just as bad), but as the examples in the talk showed, there are a lot of occasions where exceptions are not thrown, and code has to rely on error handling anyway.

C#3.0 highlights

I then attended the C#3.0 highlights talk from Oliver Sturm. I’ve been reading enough blogs that most of the stuff was at least familiar, but the talk did have some great demonstrations of the new features, and he loved showing off his animations of how much code disappears when you use the new features. It looks an even more dramatic a hit to coding speed that Java’s introduction of autoboxing and generics.

Extension Methods

The extension methods look interesting, if dangerous. They allow methods to be added to classes using a python-like method(self, args) format, which is nice, but they’re not guaranteed as any method on the original class will supercede the extension methods. So they would seem to suit only APIs that don’t change and code saturated with unit-tests for boundary cases. The only real use case I can see for them, except for the generics used by LINQ, would be to backport a new feature onto an old API so that you can code your library to the latest version, yet still provide legacy support. Oh, and extension methods can extend primative types 42.0.ToString() anyone?

Object initialization

This looks like one very useful feature. We’ve got a lot of test code in our suites that call back to database objects, which in turn have a lot of nullable foreign keys. As an example, think of Employee(id, address, supervisor, companycar, departments, roles) where departments and roles are many-to-many. At the moment, we either need to generate one constructor for every combination of possible values, or have a lot of constructor code that looks like new Employee(0, new Address(...), null, null, new List(), new List()). With object initialization we only need 2 constructors: default and full, and our previous example can look like new Employee(0) { Address = new Address(...) }; Less code, easier to maintain, and still type-safe. Best of all, I no longer need to remember the order of the arguments to the constructor, because I can name them. Much clearer. Feels even more like python 🙂 But then

Any sufficiently complicated C or Fortran program contains an ad-hoc, informally-specified bug-ridden slow implementation of half of Common Lisp.
Philip Greenspun, often called Greenspun’s Tenth Rule of Programming[19] (via Wikipedia)

Lunch : Grok Talks


Smalltalk is a great language. I’ve heard to here, and I heard it from Alan Kay. It goes back to the Common Lisp quote above. Everything that was cool about smalltalk is finally making it into other languages. Never used it in anger myself, but I’m interested in how it will work on .Net, especially as it works on an global image which contains all data and objects whereas .Net is divided discretely into DLLs with their own versions. It’ll be a project to watch I think.

Redgate SQL Data Generator

Nice looking tool. Give it a database schema and a couple of rules and it will generate real-looking data (which will validate if required), handling one-to-many and many-to-many relationships through constraints. Very nice way to set up test data. I’ve already been looking at the SQL Compare and SQL Data Compare, so this might be another one to add to the list.


It’s cmd.Net. Looks about as compatable as the VB->VB.Net transition, but it pretends it’s UNIX/DOS friendly. It’s .Net so it returns objects instead of text, which can then be manipulated via filters. The filter thing does look cool. They work well for sound and graphics, so why not command line objects? But as windows already has VBscripts and .Net supports IronRuby and IronPython, is creating a powershell scripting language overkill? So long as cmdlets are accessable throughout .Net, I can’t see powershell being much more than a quick-and-dirty prototype / debug environment, without the IDE.


Wouldn’t it be cool to ship .Net apps to any machine, via the browser, using javascript? Forget the download size for a minute, and that’s the idea behind Microsoft’s Volta. One unified .Net-based framework to share between client and server. Yeah, big deal. But here’s the cool bit: because it’s a unified framework, you can profile code across client and server, and with a couple of clicks you can refactor code between systems. Don’t know if it handles distributed servers, but the idea of optimising your code across the entire environment, with refactoring support, is a little mind-blowing. Don’t know if it’ll go the way of other Microsoft research, but it’s a neat little project.

But it works on my PC or Continuous Integration to improve quality.

The Continuous Integration talk by Richard Fennel was a good though mainly evangelical talk on why continuous integration is a good idea (short summary: Reduces last-minute surprises, doesn’t rely on human intervention to check the build, allows building and testing of things automatically overnight if tests are slow to run, and there’s other reasons too). I think I was already sold on the idea, having seen the difference between project with and without CI, but there were a few interesting things in the talk that I hadn’t considered. He recommended writing installers early on and keeping them up to date via agile methods, so you always know you have something you can install and test. This also means installers are included in the build, so you can see if and when they break. He also mentioned the Simian tool for detecting similar code blocks demonstrating cut-and-paste coding and areas ripe for refactoring. He closed the talk with a short discussion of Microsoft’s all-in-one development system Visual Studio Team Server which now includes continuous intergration and testing that covers SQL server, which is an interesting idea.

Red, Green, Refactor

This was a powerful, evangelical talk by Ben Hall on why writing tests first leads to cleaner, more effective coding. With the right tools in place, I can see it’s a very powerful way of programming, particularly when it’s against requirements, as you can start from the requirement and work down to the pieces you really need to do the work. The unit testing stuff should be second nature to most of the crowd by now, but he makes a strong case for writing test first, and making sure they fail, so that you have confidence the test works and can trust it when the code passes. There was also a good discussion of the supplimentary tools that come into play when dealing with databases, such as using stubs, mocks and proper clean-up to ensure proper testing of each layer in isolation. He also suggested that there have to be tests that do hit the real database as conditions (including, e.g. foreign key constrains) are too complex to be tested by mocks alone.


It was a very interesting day, and there’s a lot of things I’m going to have to follow up on as I come to them in my projects. I’d definitely recommend attending one of these events in the future. The next one, I believe, is in Reading in November, which I won’t be able to attend, but I’ve got my mouse finger ready for the Scotland event next year. I’ll also be following the link at the top for the slides of the talks I missed. I heard good things about the anti-patterns, user experience, regular expressions and parallel extensions sessions, so it’ll be nice to see what the fuss was about for those.

Technorati tags: , , , , , , , , , , , , , , , ,

Blogged with Flock

Blogged with the Flock Browser

Tags: , , , , , , , , , , , , , , , ,


Develper Day Scotland

I’m attending Developer Day Scotland tomorrow. Not quite sure what to expect, but there’s plenty of .Net and SQL talks so hopefully should learn something. Blog back about what I’ve learnt after. If anyone else is going, give me a shout.

Developer Day Scotland

Blogged with Flock tags: , , , , ,

Blogged with the Flock Browser