Project Success vs Project Value

Somehow earlier this year I subscribed to the chaos report email. Given the significant criticism of chaos report's measure of success - on time, on spec, on budget - I was amused by this week's email which poses the question whether their success criteria are relevant. What the Standish group does have that most of us don't, is access to a large number of (unpublished and hence unverifiable) examples.

From the email: "Which is more important project success or project value? It turns out the project success and project value is orthogonal or at right angles to each other. The harder you strive for perfect success the lower your project value. The harder you strive for greater values the lower the success rate.

We know this because we have coded each of the 50,000 projects within the CHAOS Database a success rate and value rate. Each rate has a score from 0 to 100. By grouping the projects by organization we can come up with a ranking by success and value. We then can compare the rankings. One of the items we discuss is another question Is the traditional triple Constraints (cost, time, and quality) measurement still appropriate?"

I'm surprised by the assertion that success and value are orthogonal. I'd have thought that there was at least some connection between time/cost/functionality and perceived value; if the value of your project is not in the spec, surely you wrote the wrong spec?

Just Enough Design Upfront? How to draw the line between enough and too much

Earlier this year the term Hayim Makabee proposed the term 'Adaptable Design Up Front' as a way of pointing the way forwards between the Scylla of BDUF and the Charybdis of degenerating into a Ball of Mud.

Others have used the term 'Just Enough Design Up Front.' But what counts as just enough?

That's the wrong question. Because 'just enough' is an insight that misdirects you. Design is not a scalar quantity like length. There is no amount of up-front design that is the right amount. The question is, what are the useful bits of design to do up front?

And this is what 'Adaptable Design Up Front' addresses. What you must do up-front is support the change and development to come — usually growth or change in functionality — whilst nailing down the things that ought to be fixed: the invariants which give stability so that developers don't have to re-learn the system from scratch each day they come into work.

So the basic idea is this: you want just the up-front design that helps you to draw lines between things that will change frequently and things that remain stable over time.

So how to do it?

For the 3 minute kick-start, Hayim has an excellent set of slides to get you going. His 'architecture vs interior design' analogy and the idea of applying the open/closed principle at the architecture level hit that 'brilliantly simple' spot that make it all seem obvious in hindsight.

ADUF - Adaptable Design Up Front –Hayim Makabee

For more detail on designing for what changes vs. what stays stable, I seriously recommend Jim Coplien & Gertrud Bjørnvig's under-rated book Lean Architecture: for Agile Software Development which contains decades of hard thought and wisdom. They know the pitfalls on the way first-hand and they can help you navigate them. More important, they show how to prioritise the human factors in your technical architecture. Which, as every architect knows, is what really matters.

Asp.Net MVC4 on Mono & Xamarin/MonoDevelop on Mac – The C# Template Project

Update Jan 2014: Go straight to github for MVC Templates for .Net 4 and .Net 4.5 or see asp-net-mvc4-net-framework-version-4-5-c-razor-template-for-mono-on-mac-and-linux for more recent notes.

I've been trying for a while to get this working. It all seemed so-near-and-yet-so-far. But here is the Visual Studio 2010 C# Asp.Net MVC4 Template Project which works on my Mac and (thanks to comment from Stephen) on Linux :
Visual Studio 2010 Asp.Net Mvc4 CS# Web Application Template modified for Mono

There's a list of issues which frustrated earlier attempts but the above link is to a project that does build and run on my Mac. Things to make it work included:

  • Got the latest Xamarin Studio, previously known as MonoDevelop
  • Mono version: I got MVC4 on Framework version 4 running on Mono 2.10.12; and MVC4 on Framework 4.5 on Mono 3.2.5. Nb I'm not sure whether everything related to async is currently working, but many web apps wouldn't want to use async.
  • There's a list of potential issues to address described in this stackoverflow post, I think what I did was just:
    • Delete Microsoft.Web.Infrastructure.dll from the bin directory
  • I also removed Entity Framework References. As of Jan 2014 that's not yet done on the Mono, although this may change shortly.
  • At first I commented out the line AreaRegistration.RegisterAllAreas(); in global.asax.cs Application_Start because it caused an error which appeared to refer to Entity Framework but that might just have been because I had removed System.Web.DynamicData too, so I put DynamicData back in.
  • The StyleBundles failed with a typo, or rather a case-sensitivity issue. A lot of .Net code is written on the assumption of a case-insensitive file system, but mono on *nix will usually have a case-sensitive filesystem, so you have to start being pedantic about getting the case correct. For instance App_Start/BundleConfig.cs referred to the file Site.css as site.css, so it wasn't found until I corrected it.
  • Having taking the 'intranet' template which uses Windows authentication, I changed the web.config line <deny users="?"></deny> to <allow users="?"></allow>. But this gives you no security. The simplest route back to a secure website is to instead put in forms authentication, I don't yet have a solution for windows authentication on mono.
  • I included all the nugetted package dlls in the zipfile, except that I deleted the EntityFramework stuff.

Kudos to all who worked so hard to make MVC4 on Mono possible. And of course to those who made MVC4 possible at all.

Using Castle Windsor DI for controllers in an Asp.Net WebApi Project

There are contrary signals on the web regarding Window DI and the new-ish MVC-ish WebApi IDependencyResolver. Fortunately, by late 2012 Mark Seemann summarised the state-of-the-art: don't use it.

The reason: it doesn't allow your DI container to properly manage lifetimes. Instead, do this:

public class WindsorCompositionRoot : IHttpControllerActivator
{
    private readonly IWindsorContainer container;
 
    public WindsorCompositionRoot(IWindsorContainer container)
    {
        this.container = container;
    }
 
    public IHttpController Create(
        HttpRequestMessage request,
        HttpControllerDescriptor controllerDescriptor,
        Type controllerType)
    {
        var controller =
            (IHttpController)this.container.Resolve(controllerType);
 
        request.RegisterForDispose(
            new Release(
                () => this.container.Release(controller)));
 
        return controller;
    }
 
    private class Release : IDisposable
    {
        private readonly Action release;
 
        public Release(Action release)
        {
            this.release = release;
        }
 
        public void Dispose()
        {
            this.release();
        }
    }
}

and wire it up with this line during Application_Start in Global.asax.cs

GlobalConfiguration.Configuration.Services.Replace(
    typeof(IHttpControllerActivator), new WindsorCompositionRoot());

Using Windsor for plain old MVC html pages inside WebApi projects

if you are using MVC controllers with views for html pages as well as IHttpControllers in your WebApi project, then you need to know that the WebApi controllers & activation is a quite separate subsystem from the MVC controllers. You still need the usual WindsorControllerFactory to hook Windsor into the MVC pages as well as the above for the WebApi controllers.

Code for a WindsorControllerFactory can be found in a couple of places, but this is from the Castle Windsor tutorial for Asp.Net 3 and is still valid for Asp.Net 4:

using System;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
using Castle.MicroKernel;
 
public class WindsorControllerFactory : DefaultControllerFactory
{
    private readonly IKernel kernel;
 
    public WindsorControllerFactory(IKernel kernel)
    {
        this.kernel = kernel;
    }
 
    public override void ReleaseController(IController controller)
    {
        kernel.ReleaseComponent(controller);
    }
 
    protected override IController GetControllerInstance(RequestContext requestContext, Type controllerType)
    {
        if (controllerType == null)
        {
            throw new HttpException(404, string.Format("The controller for path '{0}' could not be found.", requestContext.HttpContext.Request.Path));
        }
        return (IController)kernel.Resolve(controllerType);
    }
}

and again, you must hook it into the application object in Global.asax.cs

private static IWindsorContainer container;

//These lines should be called during Application_Start
container = new WindsorContainer().Install(FromAssembly.This());
var controllerFactory = new WindsorControllerFactory(container.Kernel);
ControllerBuilder.Current.SetControllerFactory(controllerFactory);

// And this in Application_End:
container.Dispose();