Blog

PDC, DDD and MVP

So 3 acronymns and 3 Microsoft developer community oriented updates.

Firstly, I’m off to Microsoft PDC next month. As with most conferences I expect the interesting stuff to happen in the corridors between sessions and there’s certainly a lot of great people going to be there to chat to. However, I’m also looking forward to hearing the latest gossip from MS about Vista and VS 2005. At the moment I’m somewhat cynical about what’s actually going to be left in Vista that won’t be available under Windows XP eventually (Avalon, Indigo, IE7, etc.) but I’m going with an open a mind as I can.

Of course, I’m definitely looking forward to meeting the MSBuild guys to see what their plans are.

Next up, I’m getting more involved with the London .NET community. I helped out at last month’s meeting by being on a panel answering questions about Agile Development, and I’m also going to be at DeveloperDeveloperDeveloper Day on the 22nd October. I’ve submitted a few sessions, but will wait to see if anyone’s interested in hearing me before I say I’m actually presenting. 🙂

And finally, I got made a Solutions Architect MVP! I’m not sure who nominated me but many thanks to whoever it was! I don’t hang-out much in the usual forums that a lot of MVPs frequent but I certainly hope to carry on blogging about the agile .NET world and helping out with the London .NET group.

CruiseControl.NET 1.0 RC1 Released

We’ve decided to break with our traditions on the CruiseControl.NET project and try to actually release a version 1.0! We’re not quite there yet, but have just released our first release candidate for 1.0 .

I’ll do a more detailed blog entry once 1.0 goes final (which we hope will be in the next few weeks), but until then please go and read the Release Notes.

If you do try out RC1, please email me, or the CCNet User’s mailing list with any problems / glitches / etc. with either the application or the documentation.

Madrid and Photos

Last weekend I visited Spain for first time by taking a short trip to Madrid. It was really good to get away for a few days. Especially good was the food, weather and extrememly civilised drinking hours! (i.e. there aren’t any, as far I could tell)

I’ve put some photos here, using my newish ‘Photo only’ blog.

Live 8 and Pink Floyd

The last few weeks haven’t been all bad. In fact they’ve been a bit of a rollercoaster. Just 5 days before being on the bombed Aldgate train I settled in for the day at a mate’s house to watch complete coverage of the London Live 8 concert.

Live 8 was a big event for me. The original Live Aid concerts are one of my early memories that I can appreciate (I was 7 at the time.) For some strange reason the artists I remember most from that day are Howard Jones and Phil Collins, but thankfully my music taste improved soon after!

Another reason Live 8 was a big deal to me was that I agreed with the cause. I remember from a few years back that people were talking about cancelling debt in Africa, and the unlikelyhood of it happening, but here was an event pushing for much more than this on the road to gaining real social justice across the world. People have criticised Bob Geldof for being too ‘chummy’ with Tony Blair but what’s the point of trying to change the world unless you have real influence over our leaders? And much as I disagree with Blair’s policy towards Iraq, he has always said that he feels that the situation in Africa is something that should, and can, change.

But despite all my political pretentions, the biggest reason I was so excited about Live 8 was that Pink Floyd were playing, and not just the 3 original members I had seen at Earls Court in 1994, but the complete foursome of Gilmour, Waters, Wright and Mason, something I thought I would never see. Pink Floyd are the band of my life. The Wall got me through my teenage angst years, Wish You Were Here was the album of my summer 2 years ago when I was in Boston thousands of miles from home, and so many other memories besides.

I was somewhat nervous about what they would be like. When I saw them 11 years ago they already seemed pretty old (although it was still the best gig I have ever been too) – would they still be able to hack it? Would Roger Waters throw a tantrum and storm off half way? Would the crowd stay silent wondering who the old gits were on the stage?

My fears were unfounded. Yes, they are getting old, and yes they can’t sing like they used to (to be fair they never had the best voices anyway) but they played damned well. 2 Dark Side of the Moon tracks, the crowd favourite Wish You Were Here and my favourite song of all time Comfortably Numb, with Dave Gilmour ripping his axe like he was standing back on the top of the wall 24 years ago.

Quite a day really. I thought a lot of the younger bands gave it their all, even ones I don’t like that much such as Keane and Razorlight. Madonna wins top marks for effort (plus how a woman of her advancing years can still look that good is unfathomable), and Robbie Williams, despite being a twit and not the greatest musician who has ever lived was, in a word, fabulous.

But I will never forget the sight of Dave Gilmour, Nick Mason, Rick Wright and (I still don’t believe I’m writing this) Roger Waters hugging and smiling on stage after all they’ve been through and all that’s been said between them. Thanks guys for putting arguments, even ones that last for decades, into perspective.

My experience of the London Bombings

On July 7th, a week and a half ago, I was on a Circle Line Underground train, in the rear (6th) carriage. Just before arriving at Aldgate station there was a very loud bang, the train stopped very quickly, the lights went out and fair amount of dust filled the air. The shock of the bang and the speed of all these events meant a few people screamed or gasped, but very quickly everyone on my carriage realised we were all OK, and just confused about what had happened. I had seen a quick flash at the time of the noise, and my best guess was that we had de-railed, or there had been some kind of electrical problem, causing a big power surge of some kind.

After a few minutes we could hear one or two screams from further up the train. I presumed that some people had probably fallen over with the speed of the deceleration and maybe injured themselves. A couple more minutes after this and some people in the next carriage opened the doors between the carriages and walked into ours. I decided at this point to walk right to the rear of the train to allow space for the people walking into the carriage.

About 15 minutes into the event one of the Underground workers came and opened the rear driver’s door. Being at the rear of the train I was about the 5th person out. The person who had opened the door told me to walk down the tracks on the other side of the tunnel, past my train, and up to the Aldgate platform which was just over 100 metres away. Thinking about it afterwards I realised how shaken the guy was.

It was very soon after this that the horror of the event started to dawn on me.

Once I was walking past the 4th and 3rd carriages I could see broken windows and people with blood on their faces looking out at me. I could see fear in their eyes like I’d never seen before. About this time I saw in the dim light of the tunnel that one of the train doors was lying a few feet away from the train in a mangled state. I started to wonder what on earth had happened.

As I was carefully walking around the remains of the door I heard someone on the train shout out ‘whatever you do mate, don’t look left’. It was good advice. I didn’t take it. With the speed of reflex, I looked left at where the door had been. There have been photos of the Aldgate train in the news, and we are bombarded by images of such events, whether fictional from Hollywood or real from the world media, but I can honestly say that seeing this kind of thing for real was something completely and utterly different and something I hope to never experience again. What I saw was the human equivalent of a bomb blowing a door out of a train, which I realised with horrific clarity right then was exactly what had happened.

With the same speed that I had turned to look at the train I snapped my sight back forward with every intention of getting out of the situation as quickly as I possibly could. The tunnel was eerily quiet and there seemed to be no-one around. I climbed up onto the Aldgate platform, up the stairs and into the station entrance. Being so quickly off the train, there were very few emergency services on the scene. Those that were seemed to be tending to a few people who had got off less lightly than me, yet had been able to get off the train. Again, the sight of people so terribly scared with blood all over their faces made me see how fragile human beings really are. A little later on in the day as I was walking around London I couldn’t help but feel the juxtaposition of the strength and achievement of humanity surrounding me, with the potential for weakness of the human body and spirit I had seen that day.

I walked out of the station in complete shock, and spent the rest of the day talking to friends and family. The following day I came down from the adrenaline with a huge bump and felt the whole day like I was having some kind of out-of-body experience. For those first few days afterwards I was unable to grasp the actual entire situation, I only had enough mental and emotional strength to deal with what I had been through myself.

In fact, I had been incredibally lucky. Everyone I’ve seen in the news who walked away from one of the scenes of the, as we now know them to be, suicide bombs said they were incredibally lucky too, but actually we’re not. We all suffered a terrible experience that will take time to recover from, but the appreciation of how close we came to being killed, and the desire to look forwards to the future makes us strive for positive elements in an awful situation. For myself, I don’t just look at my luck, I’m also trying to see what I’ve learned and experienced and make something constructive out of this.

As I type this I’m shaking, but the whole thing is getting easier to cope with every day. I’m not having nightmares, I am sleeping properly, and I’m not having visions of what I saw for those awful few seconds every 5 minutes like I did in the 2 days after the bomb.

I am trying to form an opinion of the whole situation. We know something now about what happened – 4 British suicide bombers with fanatical beliefs – and I’m trying to reconcile this, and my own personal experience, with my belief that a progressive, inclusive, multi-cultural society is an effective and enjoyable way forward for our race. I passionately hope that everyone from every culture and background that lives in this wonderful country really can pull together to figure out how to make sure these events never happen again.

Extending a .NET Development Tree – Versioning

The next area we’re going to look at is adding support for versioning. The .NET documentation has some fairly clear guidelines about versioning which you can read here.

Versioned assemblies can be generated on 2 types of occasion – during ‘interactive’ development and also when the automated build is used to generate distributions. For the first of these, you don’t care too much (at least initially) exactly what the name of the version is, as long as it doesn’t conflict with your distribution versions. These distribution versions though will have more structure around them, specifically:

  • The format of the version should consist of the 4 period-separated integers specified by .NET conventions
  • Version names should be unique for each distribution you publish
  • Version names should fit a specified standard for your project and organisation
  • All assemblies for one project for one distribution instance should have the same version name

These are all fine ideas, but how does it fit in with our project tree? Let’s take a look.

At the moment each Visual Studio project in our Sycamore solution has an AssemblyInfo.cs file with a bunch of default content that Visual Studio generates for us. We’re going to get rid of most of this. First of all, edit each project’s AssemblyInfo.cs file, and set the content to be something like the following:

[assembly : AssemblyTitle("My Assembly Name")]

[assembly : AssemblyDescription("")]

[assembly : AssemblyConfiguration("")]

These 3 assembly attributes are all optional, but I tend to leave them in as a hint to be filled in later.

We said above that all the assemblies for a given project should have the same version for a given distribution. To help us implement this, we are going to store all the versioning information for the entire solution in one file, called CommonAssemblyInfo.cs and saved in the src folder of our project tree. Its best to actually create this file outside of Visual Studio, and then include it as a link for every project in the solution. To do this, choose ‘Add Existing Item…’ from the project context menu, select the CommonAssemblyInfo.cs file you just created and then choose ‘Link File’ from the ‘Open’ button drop down menu.

By now you should have this file linked in every project, and the next step is to add some content to it. I tend to use the following format:

[assembly: AssemblyVersionAttribute("0")]

[assembly: AssemblyCopyrightAttribute("Copyright  2005 Sherwood Forest Inc.")]

[assembly: AssemblyCompanyAttribute("Sherwood Forest")]

[assembly: AssemblyProductAttribute("Sycamore")]

If you compile the project now and look at some of the output DLLs in Windows Explorer you should see this metadata. The AssemblyVersionAttribute value here is fine for initial interactive development, but you may need to customise it for your own environmental standards.

That’s enough for interactive builds, but what about automated builds, specifically when we want to publish distributions? An initial thought may be just to save our ‘real’ version number in the Source Control version of the CommonAssemblyInfo.cs file, but the problem with that is then our interactive development will produce assemblies with version numbers identical to our published distributions, which is far from ideal.

The next idea is that we edit the CommonAssemblyInfo.cs file every time we want to publish a distribution, but that’s manual work and as such doomed to failure. It would be much better to automate this, so that’s what we’re going to do. Specifcally, at build time, we are going to generate a new CommonAssemblyInfo.cs source file (this technique is known as code gen.) NAnt has a useful task for code genning AssemblyInfo type files called <asminfo>. To generate the same type of file we have stored in Source Control, we use the following target:

<target name="set-version">

<ifnot test="${property::exists('version')}">

<property name="version" value="${default.version}" />

</ifnot>

<asminfo output="srcCommonAssemblyInfo.cs" language="CSharp">

<imports>

<import namespace="System.Reflection" />

</imports>

<attributes>

<attribute type="AssemblyVersionAttribute" value="${version}" />

<attribute type="AssemblyCopyrightAttribute" value="Copyright  2005 Sherwood Forest Inc." />

<attribute type="AssemblyCompanyAttribute" value="Sherwood Forest" />

<attribute type="AssemblyProductAttribute" value="Sycamore" />

</attributes>

</asminfo>

<echo message="Version set to ${version}" />

</target>

You’ll notice here that version is a property which you can set externally, but defaults to a property called default.version. We need to add this default property to the build script, and also update our full target:

<property name="default.version" value="0" />

<target name="full" depends="clean, set-version, test, dist"

description="Compiles, tests, and produces versioned distributions" />

We can now build a versioned distribution as follows:

c:develSycamore>go -D:version=1.1.0.0 full

We can now build .NET-version standardized applications – great! But there’s still a manual process here – wouldn’t it be better if these distributions were generated automatically for us somewhere? The good news is they can be, but we’ll be looking at that next time.

To summarise this part:

  • Make your published distributions contain properly versioned assemblies
  • Define versioning information in a project-common source file
  • Code-gen your versioning file at automated-build time
  • Add the version name as a parameter to your automated build process

Extending a .NET Development Tree – Basic Distributions

If you read my thoughts on setting up a .NET development tree you might be interested to know how we can extend these ideas to gain even more value from automation and configuration on our .NET projects. This series of entries should help you with these investigations.

In this first entry I’m going to talk about Distributions. Distributions are one kind of artifact produced by running the automated build of your project tree. They are typically a bundling of compiled code, dependencies, configuration and documentation that enables someone to get started using your application, or update an existing copy of your application. Distributions tend to take the form of file archives (such as Zip files) or installers (such as MSI files.)

Console applications tend to allow the simplest kind of distribution. Our Sycamore example project that we created in the original article has a console application so we’re going to use this to generate an example distribution.

First of all, we’re going to add a full target to our build script. A ‘full’ build is a concept that means ‘run an end-to-end development build, and produce all artifacts’. For Sycamore’s build it looks like this:

<target name="full" depends="clean, test, dist"	description="Compiles, tests, and produces distributions" />

So far, so good. Now we need to actually create our dist target. Here it is, and I’ll explain it afterwards:

<target name="dist">

<copy todir="${build.dir}dist">

<fileset basedir="${build.dir}DebugSycamoreConsole">

<include name="***"/>

<exclude name="***.pdb" />

</fileset>

</copy>

<zip zipfile="${build.dir}Sycamore.zip">

<fileset basedir="${build.dir}dist">

<include name="***" />

</fileset>

</zip>

</target>

There are 2 clear sections to this target. The first is to setup the file tree of our distribution. In our case, we just want the Sycamore application. We specifically don’t want the .pdb debugging file. (Note to those thinking Why didn’t you just use a release build? – I’m just using the .pdb as an example of a file produced by the compile step that we don’t want in our distribution.)

One of the nice side-effects of using the Visual Studio solution/project files for defining our automated build is that all required dependencies will already be copied to the build output folder, ready for us to copy to the dist folder. In fact you can even use the pre- and post- build scripting enabled for projects in Visual Studio (but make sure that your exclude list filters out any build event batch files!) In this first section you could also add extra <copy /> sections to include documentation, license files, etc.

Once the file tree is complete, we can create the actual distribution file. In our case, we use a simple Zip file, which is appropriate for XCopy Deployment. Since all the hard work has been done in the first part of the target, the <zip /> call is very simple.

Distributions typically get much more complicated than this. Deciding exactly what files to include is something you’ll need to think carefully about. Also, you need to decide to what extent your distribution should be environment specific. For example, you may want to produce a distribution of a web application, the configuration of which has already been setup to for your production database. The benefit of this is less work for your deployment team. The drawback is that you won’t be able to deploy this distribution somewhere else. Typically, your development distributions will be environment generic, and you may introduce post-development builds to deploy and configure your application for specific environments, but that really is subject for a much bigger discussion!

Distributions are also tied in to a versioning strategy, and stored on a server somewhere, but that is also out of scope for this particular entry.

To summarise this part:

  • Produce distributions to enable your project to be used elsewhere.
  • Your distributions should be generated by a full development build.
  • Distributions should include a combination of code, dependencies, configuration and documentation.
  • Separate out the work of deciding what should be in your distribution, and creating the distribution file itself.

CruiseControl.NET 0.9 Released

A bit of a late night blog this, but its worth it. We’ve just finished off CruiseControl.NET 0.9!

Big changes in this release:

– An installer! Not just a file distribution, it also sets up your windows service and sets up your IIS settings for the Dashboard.

– Arbitrary task workflow.

– Lots of updates to the Dashboard (more plugins, more configurable, completely re-skinnable.)

The Dashboard updates were my favourite. I’ve already mentioned on this blog the fun I had with NVelocity and removing all the Web Forms code. I haven’t even mentioned yet the other fun I had combining Dependency Injection ideas with de-serialization. 🙂

Read the release notes here and download it here.

Scaling Continuous Integration talk in London

Next week Steve Freeman and I will be presenting a session in London on Scaling Continuous Integration. This is basically about how you can get the benefits of CI on larger projects.

If you’re in London and are interested in this, it will be taking place next Wednesday evening (6th April). Its totally free to come along, you just need to be able to make it to the ThoughtWorks office on High Holburn. For more details on logistics, please look here.

We’ll also be presenting this as a tutorial at SPA 2005 in a couple of week’s time.

Leaving New Zealand

I have moved back from New Zealand to the UK. Its been a very hard decision to make for a whole bunch of reasons, most of which I don’t want to go into here, but I did want to write a little about my experiences there.

New Zealand is a fantastic country. The most obvious thing is that it is beautiful. I hardly made it down to the South Island, where all the famous bits are, but even the North Island offers some great countryside. 20 miles from the centre of Auckland you can be walking through national parks of native bush and hardly see another soul.

New Zealand also has a culture that I like. It offers a healthy mix of honesty and compassion, and I think this has lead to a tolerance that I haven’t seen in other places. Sure, the fact that there are only 4 million people in a country only slightly smaller geographically than the UK helps, but I’d like to think that everyone could learn a lot from such a culture.

New Zealanders are also an intriguing bunch of people. They are resourceful beyond brits or americans, probably again because of their country’s relatively small size, but I guess also because of their isolation. Using the IT industry as an example, you are much more likely to find ‘jack of all trade’ developers than in the UK, where specialisation tends to be the norm.

Its not a perfect country though. The distance to anywhere else, especially beyond Australia, is hard. Apart from anything else I think that New Zealand could look more beyond itself, but maybe that’s just plain impractical. It also suffers hugely from emigration. Something like 15% of kiwis live outside of their own country, and of course this creates a huge ‘brain drain’.

New Zealanders are also terrible drivers 😉 .

I’m back in London now, at least for a few months, at which point I might move on somewhere else. Of course, there are many things available from a London life that I missed in New Zealand, but I will always look back fondly at my time there.