random thoughts and discussions on the things that interest me

Running Roslyn on a Build Server

If like the majority of people you shy away from installing a full blown copy of Visual Studio on your build server (for whatever reason) but you’d like to use it to compile using Roslyn then this can be achieved by following the advice given on this StackOverflow post. The steps I took were as follows:

1. Install the Roslyn End User Preview on the machine you use for developing.

2. Locate the following folder %userprofile%\AppData\Local\Microsoft\MSBuild\12.0

3. Copy the file Microsoft.CSharp.Roslyn.targets from \Microsoft.CSharp.targets\ImportAfter into C:\Program Files (x86)\MSBuild\12.0 on the build server into similarly named folders

4. Open up the file Microsoft.CSharp.Roslyn.targets and locate the element named RoslynToolPath and make a note of it’s value. This is the location of the compiler on your development machine.

5. Copy the contents of the folder containing the compiler onto the build server and place it them in a folder that is accessible from the security context under which the build process will be running.

5. Replace the RoslynToolPath in the Microsoft.CSharp.Roslyn.targets file on the build server with the path into which you have just copied the compiler.

6. Repeat for Microsoft.VisualBasic.Roslyn.targets if you want to build VB.NET using Roslyn too.

CQRS Presentation

I recently gave a presentation on Command and Query Responsibility Segregation (CQRS) as a follow-on from my event sourcing talk. This is really an overview of my understanding of CQRS which has been heavily influenced by the DDD community and shaped by the experiences that I’ve gained in my job over the past 18 months.

In contrast to my last presentation the content of this one was mostly my own. A large part of the talk was demonstration of a working CQRS application which I stepped through in debug mode to illustrate the flow of data in the system. The source code for that application can be found here:

The reaction to the talk was positive and, once more, it generated quite a bit of debate. As before, for those that attended (or are interested) my course the slides and notes for my presentation can be found here: cqrs.pptx

Welcome to my New Website

For the past 8 or so years I’ve been hosting my own website in various forms on my own hardware located for the most part in a cupboard under the stairs. Today I’ve finally made the leap and moved everything to the cloud.

As part of the transition I’ve also upgraded my blog engine from to WordPress. This was made easier by my choice to host on Azure which provides a pre-configured website bundle from the gallery. I was actually up and running within minutes.

I chose an open-source theme called metro-wp-theme written by Joe McBride who’s website can be found here. I also installed a Syntax Highlighter plugin that formats source code rather nicely.

The theme required a few tweaks for my needs most of which were detailed on the theme page on Joe’s site but the bulk of the work was in transferring old posts from my previous blog onto this one. I have not yet been through the process of migrating the comments so for the moment comments are missing from the old posts.

Anyway, I’ve just changed the DNS records so if you’re reading this post it’s been a success. Welcome to my new website!

ScrumMaster Certification

I recently attended a Certified ScrumMaster course in Zurich given by Jeff Sutherland.

While Jeff’s anecdote that he invented Scrum when flying missions as a top gun fighter pilot for the US during the Vietnam war might not be literally true, it might be. Because he did invent Scrum. Well, co-invent it anyway.

As it turned out, the course was a far more valuable experience than I could have imagined it would be. I think in my case that I was able to gain so much from it through being able to relate the work that I’ve been doing in Agile environments over the past five years where I have spent the majority of my time as a Scrum team member in teams that have seen varying degrees of success.

I did not take the course because I want to be a ScrumMaster. I took the course because I wanted to know why when we were practising Scrum projects were liable to fail, team morale was low, there was a disjoint between what we committed to and what we delivered, etc.

And these questions got answered. In fact, all my questions got answered. I understand why these things happened. Now I have some tips on how to go forward. My understanding of Scrum now has a grounding and I can help others to reach that understanding too. But mostly, I learnt that I have much more to learn. But that’s not a bad thing, and in some terms its apt especially as Jeff thinks of Scrum as a martial art.

I suppose the point of this post is that if you’re going to learn about Scrum it would be my recommendation to learn from Jeff. Lets just say “he knows what he’s talking about”.

Event Sourcing Presentation

I gave a presentation recently on event sourcing. The talk included a demonstration of a system that I had been involved in designing and implementing that made use of events as a mechanism for storage.

The content of the presentation was heavily influenced by Grey Young’s QCon talk “Events are not just for Notifications” hosted on InfoQ here - in some places to the point of verbatim – so if you are interested in the message I was trying to convey I suggest you watch his video. For those that attended my course the slides and notes for my presentation can be found here: eventsourcing.pptx

I was surprised by the interest in the topic especially from some senior architects. It would appear there is a growing recognition that there is an inherent reduction in complexity when you’re forced to think of the boundaries that are implicitly enforced when moving to a distributed architecture.

As the reaction to the talk was good I shall be giving a follow up talk in September – this time on the subject of CQRS.

Discussing NuGet Performance Issues via Twitter

Recently I vented my frustrations on twitter about how I found NuGet painfully slow and was surprised when Grigori Melnick picked up on my tweet and the whole thing turned into a positive discussion (below).

CQRS and when the Penny Dropped

I’ve been working on a project for a while now where the requirement is to provide a more scalable and better performing version of an existing system.

We chose to base the new system on Greg Young’s open-source SimpleCQRS project. Earlier this week I was refactoring one of the domain objects when I came across something like the following:

private string description;

public string Description
    get { return this.description; }

public void ChangeDesciption(string description)
    ApplyChange(new DescriptionChanged { Description = description });

private void Apply(DescriptionChanged @event)
    this.description = @event.Description;

I noted that the public Description property was unused, so I removed it.

Then the penny dropped.

I noticed that I could remove the private description property too because it was not used in any of the business logic. Then the previous sixteen lines of code became the following four:

public void ChangeDesciption(string description)
    ApplyChange(new DescriptionChanged { Description = description });

Less code. More sense. And a growing realisation that I had been confusing the responsibility of the GUI to display the description of the product with that of the domain object which was only concerned with business logic – something that the product description had nothing to do with.

TeamCity, MSBuild 4.0, a 64bit Server, and Could Not Load File or Assembly

I’ve been spending some time recently setting up TeamCity for continuous integration and stumbled upon an annoying issue that had me stumped for a while.

Following a simple update to a build script where I changed the way paths were resolved my build started failing. The error message was (cut down):,5): error MSB4062: The "xxx" task could not be loaded 
from the assembly C:\Program Files%28x86%29\ .. \xxx.dll. Could not load 
file or assembly. The system cannot find the file specified.

After some serious head scratching and a lot of Google time it turns out that this is a bug with MSBuild 4.0. Basically MSBuild 4.0 can’t handle paths with parentheses in certain situations. As the path on the server to the build files was under c:\Program Files (x86)\ it was just falling over with a file not found exception. The work around suggested by Microsoft is to compensate by decoding the path reference in your build script. In my case this meant changing from this:

  TaskName="xxx" />

to this:

  TaskName="xxx" />

Simples, no?

Coding Nightmare

Oh. I’m not relishing trying to get my head around this…

Stored Procedures vs. ORM

I was recently asked to give an explanation of my preference toward use of stored procedures vs. an ORM solution which happens to be a question that I have considered several times during development myself so I thought I’d throw in my 10 cents, so to speak.

Listing each of their respective benefits is not something I intend to do as there’s plenty out there in the developer community doing just that. Looking about you can find a couple of detailed post on (here and here) that describe some of the advantages and disadvantages of each solution. There was a response on one of those threads from an individual who came from a database background who was leaning toward ORM generally for reasons around the simplicity of certain operations and the reduced time in writing them. As for me, I have a tendency to lean a little the other way – whilst I agree with the reduced development time associated with an ORM solution I like the enforced separation of concerns imposed by accessing the database just through stored procedures (although I appreciate that if you’re implementing the repository pattern then there is a separation imposed there).

Knowing also that stored procedures can do much more than perform CRUD operations and queries plays a part in my opinion. Enterprise applications can benefit from stored procedures performing operations that ORM was never designed to replace like distributed transactions, message queuing etc. and remember: stored procedures can be changed\tweaked without requiring a re-release of compiled code.

In my opinion then, the factors that come in to play are speed of development vs. ease of update – and I’d go with ease of update FTW. That means if you’ve got a database team I suggest you use them.

Older Posts »