<?xml version="1.0" encoding="utf-8"?>
<feed xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xml:lang="en-us" xmlns="http://www.w3.org/2005/Atom">
  <title>Insane World - Casey Charlton</title>
  <link rel="alternate" type="text/html" href="http://blog.goinsane.co.uk/" />
  <link rel="self" href="http://blog.goinsane.co.uk/SyndicationService.asmx/GetAtom" />
  <icon>favicon.ico</icon>
  <updated>2008-05-01T11:00:01.8096673-07:00</updated>
  <author>
    <name>Casey Charlton</name>
  </author>
  <subtitle>Sometimes the appropriate response to reality is to go insane - Philip K Dick</subtitle>
  <id>http://blog.goinsane.co.uk/</id>
  <generator uri="http://www.dasblog.net" version="2.0.7180.0">DasBlog</generator>
  <entry>
    <title>I'm Moving ...</title>
    <link rel="alternate" type="text/html" href="http://blog.goinsane.co.uk/2008/05/01/ImMoving.aspx" />
    <id>http://blog.goinsane.co.uk/PermaLink,guid,8ca9cfff-7dcc-4a9c-a2fb-ae2be5bd5858.aspx</id>
    <published>2008-05-01T11:00:01.8096673-07:00</published>
    <updated>2008-05-01T11:00:01.8096673-07:00</updated>
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
After a nice offer to join the blog roll at devlicio.us I have decided to retire my
existing blog at <a href="http://blog.goinsane.co.uk/">http://blog.goinsane.co.uk/</a>,
and move across to devlicio.us for my blogging. 
</p>
        <p>
  
</p>
        <p>
I see this as an opportunity to rant at a new audience ... but I may post something
useful from time to time too. 
</p>
        <p>
  
</p>
        <p>
You can find future posts at: <a title="http://devlicio.us/blogs/casey/default.aspx" href="http://devlicio.us/blogs/casey/default.aspx">http://devlicio.us/blogs/casey/default.aspx</a><img width="0" height="0" src="http://blog.goinsane.co.uk/aggbug.ashx?id=8ca9cfff-7dcc-4a9c-a2fb-ae2be5bd5858" /></p>
      </div>
    </content>
  </entry>
  <entry>
    <title>Are Broken Builds a Bad Thing?</title>
    <link rel="alternate" type="text/html" href="http://blog.goinsane.co.uk/2008/03/26/AreBrokenBuildsABadThing.aspx" />
    <id>http://blog.goinsane.co.uk/PermaLink,guid,944108dd-0714-4f17-be2d-8559353096a7.aspx</id>
    <published>2008-03-26T02:14:57.081-07:00</published>
    <updated>2008-03-26T02:14:57.0814002-07:00</updated>
    <category term=".NET" label=".NET" scheme="http://blog.goinsane.co.uk/CategoryView,category,.NET.aspx" />
    <category term="Agile" label="Agile" scheme="http://blog.goinsane.co.uk/CategoryView,category,Agile.aspx" />
    <category term="alt.net" label="alt.net" scheme="http://blog.goinsane.co.uk/CategoryView,category,alt.net.aspx" />
    <category term="C#" label="C#" scheme="http://blog.goinsane.co.uk/CategoryView,category,C%23.aspx" />
    <category term="Continuous Integration" label="Continuous Integration" scheme="http://blog.goinsane.co.uk/CategoryView,category,Continuous%2BIntegration.aspx" />
    <category term="Design" label="Design" scheme="http://blog.goinsane.co.uk/CategoryView,category,Design.aspx" />
    <category term="Development" label="Development" scheme="http://blog.goinsane.co.uk/CategoryView,category,Development.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
Prompted by a discussion on the altdotnet yahoo group ... why I like broken builds
...
</p>
        <p>
Some people try desperately to avoid breaking the build, by doing very infrequenet
check ins (the number of broken builds per day drops dramatically, the time to fix
each goes up though), or by trying to ensure their development environment is as close
to the build environment as possible.
</p>
        <p>
But a broken build is not a problem - it is an opportunity. A broken build allows
you to identify a weakness, and to resolve it early.
</p>
        <p>
The weakness might be in your architecture, it may be in your dependencies, or in
your assumptions, or in your developer skill levels - but the whole point of having
a continuous integration server is to fail fast and let you deal with the underlying
problems rather than the specifics of the code you checked in.
</p>
        <p>
 
</p>
        <img width="0" height="0" src="http://blog.goinsane.co.uk/aggbug.ashx?id=944108dd-0714-4f17-be2d-8559353096a7" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Windsor Container Registration of Generic Component via C# Code</title>
    <link rel="alternate" type="text/html" href="http://blog.goinsane.co.uk/2008/03/20/WindsorContainerRegistrationOfGenericComponentViaCCode.aspx" />
    <id>http://blog.goinsane.co.uk/PermaLink,guid,c8963087-ae3d-40b8-b67c-1f221bbe1aa9.aspx</id>
    <published>2008-03-20T02:44:12.505-07:00</published>
    <updated>2008-03-20T02:44:12.5058972-07:00</updated>
    <category term="alt.net" label="alt.net" scheme="http://blog.goinsane.co.uk/CategoryView,category,alt.net.aspx" />
    <category term="C#" label="C#" scheme="http://blog.goinsane.co.uk/CategoryView,category,C%23.aspx" />
    <category term="Castle" label="Castle" scheme="http://blog.goinsane.co.uk/CategoryView,category,Castle.aspx" />
    <category term="Sample Code" label="Sample Code" scheme="http://blog.goinsane.co.uk/CategoryView,category,Sample%2BCode.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
I've done it before, but my mind went totally blank yesterday ... due to some typically
quick responses from the <a href="http://groups.google.com/group/castle-project-users?hl=en">Castle
Users Google Group</a> ... here is the code to do it for future generations to avoid
my same silly mistakes ... 
</p>
        <pre>
          <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">WindsorContainer
container <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">new</span> WindsorContainer();
Type eventBrokerServiceType <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">typeof</span>(IEventBroker&lt;&gt;);
Type brokerType <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">typeof</span>(EventBroker&lt;&gt;);
container.AddComponent(<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"key"</span>,
eventBrokerServiceType, brokerType); IEventBroker&lt;EventArgs&gt; eventBroker <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> container.Resolve&lt;IEventBroker&lt;EventArgs&gt;&gt;();
Assert.IsNotNull(eventBroker); </span>
        </pre>
        <img width="0" height="0" src="http://blog.goinsane.co.uk/aggbug.ashx?id=c8963087-ae3d-40b8-b67c-1f221bbe1aa9" />
      </div>
    </content>
  </entry>
  <entry>
    <title>VSTS Code Coverage Runner</title>
    <link rel="alternate" type="text/html" href="http://blog.goinsane.co.uk/2008/03/15/VSTSCodeCoverageRunner.aspx" />
    <id>http://blog.goinsane.co.uk/PermaLink,guid,7a4d8c92-293a-4721-b7ff-90e03ed98ad4.aspx</id>
    <published>2008-03-15T14:37:51.2500572-07:00</published>
    <updated>2008-03-15T14:37:51.2500572-07:00</updated>
    <category term=".NET" label=".NET" scheme="http://blog.goinsane.co.uk/CategoryView,category,.NET.aspx" />
    <category term="Code Coverage" label="Code Coverage" scheme="http://blog.goinsane.co.uk/CategoryView,category,Code%2BCoverage.aspx" />
    <category term="Development" label="Development" scheme="http://blog.goinsane.co.uk/CategoryView,category,Development.aspx" />
    <category term="Sample Code" label="Sample Code" scheme="http://blog.goinsane.co.uk/CategoryView,category,Sample%2BCode.aspx" />
    <category term="Testing" label="Testing" scheme="http://blog.goinsane.co.uk/CategoryView,category,Testing.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
A short while ago I wanted to get VSTS code coverage reports from NUnit tests ...
and after some asking around found that using the Profiler I could get what I needed.
I just released a <a href="http://www.codeplex.com/codecoveragerunner" target="_blank">CodePlex
project to wrap this functionality</a>. Hope it helps somebody else.
</p>
        <p>
          <b>Project Description</b>
          <br />
This project is an attempt to provide a wrapper around the VSTS instrumentation and
code coverage tools.
</p>
        <p>
VSTS provides very powerful code coverage tools with Visual Studio, but as packaged,
you need to be running MSTest unit tests to obtain this coverage data. There is a
way of getting this data without using MSTest though, bu using another test framework
such as NUnit or MbUnit for example.
</p>
        <p>
This wrapper encapsulates the generation of the .coverage file from a run of NUnit
or MbUnit (or similar), but in addition it provides an automated generation of the
.xml version of the .coverage file (both can be read by Visual Studio directly), and
then uses an XSLT template to transform the XML output into a final human readabale
page (by default a .html file)
</p>
        <p>
Further extension will pull the actual parameters from the hardcoded values in the
console application into a wrapper class, and will wrap both with a command line tool
and with an MSBuild task - however the code is functional enough, and is transparent
enough, that both of these tasks should be easy to implement for anyone wishing to
do so for themselves if they require this immediately.
</p>
        <p>
 
</p>
        <div class="wlWriterSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:db72dcfb-fbe2-4291-a98e-b04c275624b2" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px">Technorati
Tags: <a href="http://technorati.com/tags/.net" rel="tag">.net</a>,<a href="http://technorati.com/tags/codeplex" rel="tag">codeplex</a>,<a href="http://technorati.com/tags/VSTS" rel="tag">VSTS</a>,<a href="http://technorati.com/tags/code%20coverage" rel="tag">code
coverage</a>,<a href="http://technorati.com/tags/unit%20testing" rel="tag">unit testing</a></div>
        <img width="0" height="0" src="http://blog.goinsane.co.uk/aggbug.ashx?id=7a4d8c92-293a-4721-b7ff-90e03ed98ad4" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Software Development Checklists for Good Design</title>
    <link rel="alternate" type="text/html" href="http://blog.goinsane.co.uk/2008/03/06/SoftwareDevelopmentChecklistsForGoodDesign.aspx" />
    <id>http://blog.goinsane.co.uk/PermaLink,guid,a1139c2a-3a15-4d04-9906-24fb9f02a523.aspx</id>
    <published>2008-03-06T00:58:05.239-07:00</published>
    <updated>2008-03-06T00:58:05.2395119-07:00</updated>
    <category term="Design" label="Design" scheme="http://blog.goinsane.co.uk/CategoryView,category,Design.aspx" />
    <category term="Development" label="Development" scheme="http://blog.goinsane.co.uk/CategoryView,category,Development.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
As I am about to use a number of these to try and identify weakenesses in our current
requirements and documentation, I thought I would link them for the benefit of all
- I'm not sure many people know these exist and are available online. They come from
possibly the best book written on software development, <a href="http://www.cc2e.com/">Code
Complete 2</a> by <a href="http://blogs.construx.com/blogs/stevemcc/default.aspx">Steve
McConnell</a></p>
        <p>
You can <a href="http://cc2e.com/Page.aspx?nid=73">read the full list of checklists</a> (a
free and simple registration is required), but the ones I think are critical to the
success of a project are from the Requirements Checklist. As Steve says, they may
not be comprehensive, they may not be complete, they don't tell you how to do these
things, it is just a good sanity checking list:
</p>
        <p>
          <strong>Specific Functional Requirements</strong>
        </p>
        <ul>
          <li>
Are all the inputs to the system specified, including their source, accuracy, range
of values, and frequency? 
<br /></li>
          <li>
Are all the outputs from the system specified, including their destination, accuracy,
range of values, frequency, and format? 
<br /></li>
          <li>
Are all output formats specified for web pages, reports, and so on? 
<br /></li>
          <li>
Are all the external hardware and software interfaces specified? 
<br /></li>
          <li>
Are all the external communication interfaces specified, including handshak-ing, error-checking,
and communication protocols? 
<br /></li>
          <li>
Are all the tasks the user wants to perform specified? 
<br /></li>
          <li>
Is the data used in each task and the data resulting from each task specified? 
<br /></li>
        </ul>
        <p>
          <strong>Specific Non-Functional (Quality) Requirements</strong>
          <br />
        </p>
        <ul>
          <li>
Is the expected response time, from the user's point of view, specified for all necessary
operations? 
<br /></li>
          <li>
Are other timing considerations specified, such as processing time, data-transfer
rate, and system throughput? 
<br /></li>
          <li>
Is the level of security specified? 
<br /></li>
          <li>
Is the reliability specified, including the consequences of software failure, the
vital information that needs to be protected from failure, and the strategy for error
detection and recovery? 
<br /></li>
          <li>
Is maximum memory specified? 
<br /></li>
          <li>
Is the maximum storage specified? 
<br /></li>
          <li>
Is the maintainability of the system specified, including its ability to adapt to
changes in specific functionality, changes in the operating environment, and changes
in its interfaces with other software? 
<br /></li>
          <li>
Is the definition of success included? Of failure? 
</li>
        </ul>
        <p>
          <strong>Requirements Quality</strong>
          <br />
        </p>
        <ul>
          <li>
Are the requirements written in the user's language? Do the users think so? 
<br /></li>
          <li>
Does each requirement avoid conflicts with other requirements? 
<br /></li>
          <li>
Are acceptable trade-offs between competing attributes specified-for ex-ample, between
robustness and correctness? 
<br /></li>
          <li>
Do the requirements avoid specifying the design? 
<br /></li>
          <li>
Are the requirements at a fairly consistent level of detail? Should any re-quirement
be specified in more detail?<br /></li>
          <li>
Should any requirement be specified in less detail? 
<br /></li>
          <li>
Are the requirements clear enough to be turned over to an independent group for construction
and still be understood? 
<br /></li>
          <li>
Is each item relevant to the problem and its solution? Can each item be traced to
its origin in the problem environment? 
<br /></li>
          <li>
Is each requirement testable? Will it be possible for independent testing to determine
whether each requirement has been satisfied? 
<br /></li>
          <li>
Are all possible changes to the requirements specified, including the likeli-hood
of each change? 
</li>
        </ul>
        <p>
          <strong>Requirements Completeness<br /></strong>
        </p>
        <ul>
          <li>
Where information isn't available before development begins, are the areas of incompleteness
specified? 
<br />
Are the requirements complete in the sense that if the product satisfies every requirement,
it will be acceptable? 
<br /></li>
          <li>
Are you comfortable with all the requirements? Have you eliminated re-quirements that
are impossible to implement and included just to appease your customer or your boss? 
</li>
        </ul>
        <img width="0" height="0" src="http://blog.goinsane.co.uk/aggbug.ashx?id=a1139c2a-3a15-4d04-9906-24fb9f02a523" />
      </div>
    </content>
  </entry>
  <entry>
    <title>One Step Towards Better Software Development</title>
    <link rel="alternate" type="text/html" href="http://blog.goinsane.co.uk/2008/03/03/OneStepTowardsBetterSoftwareDevelopment.aspx" />
    <id>http://blog.goinsane.co.uk/PermaLink,guid,0a480411-0789-4d75-91de-c5201c17ebca.aspx</id>
    <published>2008-03-03T03:15:37.598-07:00</published>
    <updated>2008-03-03T23:18:05.4463069-07:00</updated>
    <category term="Agile" label="Agile" scheme="http://blog.goinsane.co.uk/CategoryView,category,Agile.aspx" />
    <category term="Castle" label="Castle" scheme="http://blog.goinsane.co.uk/CategoryView,category,Castle.aspx" />
    <category term="Design" label="Design" scheme="http://blog.goinsane.co.uk/CategoryView,category,Design.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <h3>The problem
</h3>
        <p>
We currently develop software in a fairly piecemeal and disjointed fashion. The software
we develop could also be fairly accurately described as monolithic.
</p>
        <p>
There are many problems that come with monolithic code, it becomes hard to maintain,
hard to evolve, hard to reuse, and hard to adapt to changing requirements.
</p>
        <p>
Symptoms of a <b>Rotting Design</b><sup>[1]</sup> include:
</p>
        <h5>Rigidity
</h5>
        <p>
Rigidity is the tendency for software to be difficult to change, even in simple ways.
Every change causes a cascade of subsequent changes in dependent modules.
</p>
        <h5>Fragility
</h5>
        <p>
Closely related to rigidity is fragility. Fragility is the tendency of the software
to break in many places every time it is changed. Often the breakage occurs in areas
that have no conceptual relationship with the area that was changed.
</p>
        <h5>Immobility
</h5>
        <p>
Immobility is the inability to reuse software from other projects or from parts of
the same project. It often happens that one engineer will discover that he needs a
module that is similar to one that another engineer wrote. However, it also often
happens that the module in question has too much baggage that it depends upon.
</p>
        <h5>Viscosity
</h5>
        <p>
Viscosity comes in two forms: viscosity of the design, and viscosity of the environment.
When faced with a change, engineers usually find more than one way to make the change.
Some of the ways preserve the design, others do not (i.e. they are hacks.) When the
design preserving methods are harder to employ than the hacks, then the viscosity
of the design is high. It is easy to do the wrong thing, but hard to do the right
thing.
</p>
        <h5>What kinds of changes cause designs to rot?
</h5>
        <p>
Changes that introduce new and unplanned for dependencies cause rotting designs. Each
of the four symptoms mentioned above is either directly, or indirectly caused by improper
dependencies between the modules of the software. It is the dependency architecture
that is degrading, and with it the ability of the software to be maintained.
</p>
        <p>
In order to forestall the degradation of the dependency architecture, the dependencies
between modules in an application must be managed. This management consists of the
creation of dependency firewalls. Across such firewalls, dependencies do not propagate.
</p>
        <p>
Object Oriented Design is replete with principles and techniques for building such
firewalls, and for managing module dependencies.
</p>
        <h4>The goal
</h4>
        <p>
To avoid some of the problems we are currently encountering, we need to move towards
software development based on good principles and practices. There is fundamentally
little new in software development each year, but better refinement of common patterns
and practices, and we should be leveraging those to provide a more stable and adaptable
software codebase.
</p>
        <h4>The approach
</h4>
        <p>
This document deals with a limited subset of the problem; specifically it is designed
to explain the requirements for Castle Windsor and Castle DynamicProxy to be included
in our code. As such it does touch on a number of principles that are only partially
resolved by the Castle stack, it also omits many other good principles of software
development – these can be left for another discussion.
</p>
        <p>
There are a number of aspects of what we currently do that could be improved by better
training, better practice, and better communication – but these will not be
covered in detail here.
</p>
        <p>
          <b>
          </b>
        </p>
        <h4>The objectives
</h4>
        <p>
So as our problem is relatively wide in scope, here are some specific principles that
we should be aiming for in our code. These are fairly widely established principles
within the industry, so none should be of any great surprise. Possibly the greater
surprise will be that we are using almost none of these, at least not in any explicit
or agreed upon method. This list is only a subset of a wider set or principles we
should be aiming for.
</p>
        <h5>Single Responsibility Principle (SRP) <sup>[2]</sup></h5>
        <p>
          <i>There Should Never Be More That One Reason for a Class to Change</i>
        </p>
        <p>
Responsibilities should be considered as axis of change – if a class assumes
more than one responsibility, then it has more than one possible reason to change,
and becomes a weak point in the design. This coupling leads to fragile designs that
break in unexpected ways.
</p>
        <p>
This class level principle applies at a wider level, where it is commonly referred
to as Separation of Concerns.
</p>
        <h5>Separation of Concerns (SoC) <sup>[3]</sup></h5>
        <p>
The principle that software components should be broken to smaller parts that overlap
in functionality as little as possible. Examples of SoC in practice would be adoption
of design patterns such as Model-View-Presenter, or Service Oriented Architecture.
</p>
        <p>
A concern at modular level could be considered the separation of display logic, from
business logic. The separation of data access from data manipulation. Or at a lower
level, the separation of configuration from processing logic.
</p>
        <p>
By separating each of the concerns away from each other – you obtain the ability
to alter each of those concerns independently, whether due to a change in the requirements,
and evolution of the system, a bug fix, or for any other reason you may have for change.
</p>
        <p>
Application of SoC allows you to create and evolve Loosely Coupled Systems, a primary
objective of good software design.
</p>
        <h5>The Dependency Injection Principle (DIP) <sup>[4]</sup></h5>
        <p>
          <i>A: High Level Modules Should Not Depend Upon Low Level Modules, Both Should Depend
Upon Abstractions 
<br />
B: Abstractions Should Not Depend Upon Details, Details Should Depend Upon Abstractions</i>
        </p>
        <p>
By inverting the dependency structure we eliminate a common problem where a small
change to environment or requirements cascades through our entire application. By
using the DIP we isolate those changes.
</p>
        <p>
Consider the most commonly written example, that of a class or component that requires
configuration information – for the sake of this example let us refer to it
as the DataService class.
</p>
        <p>
A traditional approach to writing this might be to have the DataService class call
the ConfigurationManager to get the settings it requires. At this point however, your
class now depends upon the ConfigurationManager – it cannot be compiled if this
manager is not present, it cannot execute if this class is not present, and it cannot
have the source of its configuration information changed without a recompilation at
least, and possibly a rewrite at worst.
</p>
        <p>
Dependency Injection turns this concept upside down – quite literally. This
is why this is commonly referred to as <b>Inversion of Control (IoC) <sup>[5]</sup></b></p>
        <p>
We now design our DataService class so that instead of it talking directly to a ConfigurationManager,
it is given an abstraction of the ConfigurationManager by the code that created our
class. The responsibility for the source and creation of the ConfigurationManager
is no longer a concern of our DataService class, but of the thing that created it.
So in our example we create an interface called IConfigurationManager, one implementation
of which is our real ConfigurationManager. Now when we create our DataService, we
tell it specifically which instance of IConfigurationManager it should use to get
its configuration information.
</p>
        <p>
This principle has multiple benefits, apart from helping achieve the primary objectives
of maintainability, SoC and SRP, it also fulfils one other fundamental objective,
it allows Unit Testing.
</p>
        <p>
If a class like our original DataService is to be unit tested, we must have a ConfigurationManager
in place. The ConfigurationManager must be the exact same version as will be used
in our application, and it will bring with it all the dependencies it contains. In
fact, you will probably have to put the DataService into a nearly fully implemented
application, just to test a basic part of its behaviour.
</p>
        <p>
After we have applied Inversion of Control we can now unit test the DataService independently
of its configuration requirements. We can create a mock implementation of our IConfigurationManager
that passes in a known configuration set, and therefore allows us to have a known
outcome state after a request. We are no longer tied to tests that may break when
someone changes the format of the configuration data, or changes the data store, and
in the case of our DataService, we no longer require a database in place, just to
see if the DataService correctly requests database information.
</p>
        <h5>Unit Testing and Test Driven Development <sup>[6][7]</sup></h5>
        <p>
By using Inversion of Control we can now write valid unit tests. The qualification
of “valid” is very important here, a poor unit test is one that tests
more than it should – in much the same way as application of SRP, a unit test
that tests more than one thing is fragile and prone to breaking for the wrong reasons.
</p>
        <p>
A differentiation should also be drawn between a “unit test” and an “automated
integration test”. While both may use a xUnit framework such as NUnit or MbUnit,
there is a very important distinction. A unit test tests one thing and one thing only
... it tests a “unit” – an integration test tests more than one
thing, hence it is not a unit test. 
</p>
        <p>
So back to our previous example, a unit test that tested a function of the DataService
is desirable and should be our primary objective, but if it was to test the DataService
that called the ConfigurationManager, it is now actually testing at least two components,
and is possibly testing a few dozen more (all of the dependencies that ConfigurationManager
has are being tested too). With IoC we can provide a mock IConfigurationManager and
ensure we are only testing the DataService – a single unit. Changes to the ConfigurationManager
implementation or one of its dependencies can no longer break our unit tests.
</p>
        <p>
Not only that, but it is entirely possible in our example that we cannot unit test
our DataService at all, as it requires infrastructure code and data that may not be
present at test time. It is also highly likely that we will end up with a large and
interdependent set of configuration sources within our tests to try and mimic all
the possible permutations of configuration data we may expect, creating highly fragile
and hard to understand tests.
</p>
        <p>
One simple abstraction avoids all of this.
</p>
        <p>
          <b>
          </b>
        </p>
        <h4>The solution 
</h4>
        <h5>So Why Do We Need an Inversion of Control Container?
</h5>
        <p>
The example given so far is pretty easy to follow. We don’t access configuration
within our DataService, but the code that creates the DataService also creates the
ConfigurationManager implementation and passes it in.
</p>
        <p>
However if you follow this all the way down the software stack, you will realise that
at some point, there must be a concrete dependency ... something has to know how to
create all these concrete dependencies, and therefore it has the dependencies itself.
</p>
        <p>
This is where an IoC container such as Castle Windsor comes into play.
</p>
        <h5>What Does Castle Windsor <sup>[8]</sup> Do?
</h5>
        <p>
Inversion of Control containers allow you to achieve loosely coupled designs and they
handle dependency and configuration management when you, or a class in your system,
request a service to say, send e-mails, you will get an instance ready to be used.
</p>
        <p>
IoC containers favour reuse as they allow you to use a natural idiom to expose the
component's dependencies. This allows components to be used with or without containers.
Hence you quickly end up with a library of reusable components that can be shared
among projects, as long as you apply the Separation of Concerns principle.
</p>
        <p>
Castle Windsor allows components within the system to be registered with it, and when
it receives requests for those objects, it is responsible for creating them, and maintaining
their lifestyles. Where you require a singleton, it will provide that for you, and
where you require a thread pooled object, it can provide that for you too –
without any alteration of your codebase.
</p>
        <p>
More importantly, it is capable of resolving all sub-dependencies that a class has.
So back to our example, we don’t need to create an instance of the IConfigurationManager,
and an instance of the DataService, or create any instances of all the other things
that DataService may depend upon – Windsor knows all of this and will do this
work for us.
</p>
        <p>
So when we ask Windsor to give us the DataService, it will create all dependency objects
too, pull configuration from an external source if we have specified that, and return
us back a single fully constructed object graph. This avoids the problems of fragile
code, as a change to the dependencies of our DataService is now transparent to all
the code that uses our DataService.
</p>
        <p>
Windsor also brings additional benefits far beyond the basics of object creation and
management. As it contains the ability to create interceptors, it becomes very easy
to add functionality that exposes cross cutting concerns such as logging. When we
request our DataService now, Windsor knows that our configuration says Windsor should
attach a logger to our methods, and it will do all the work needed to create the classes
to manage those objects. This functionality can be extended to allow for many other
cross cutting concerns such as authentication, authorization, and extension of existing
business logic.
</p>
        <p>
The critical part of Windsor for us in many respects is that it is highly extensible;
almost any scenario you can envisage with regards to object creation or management
is a simple step to configure or to extend.
</p>
        <h5>What is Castle Windsor?
</h5>
        <p>
Castle Windsor is a component part of the Castle open source project that has been
in existence since 2003, and was built upon lessons learned from the Java community
and earlier .Net projects.
</p>
        <p>
Most recently, part of the Castle stack, MonoRail has been a major factor in Microsoft
moving towards MVC development under ASP.NET, with contributors to MonoRail being
asked for their views on the development direction by the team developing ASP.NET
MVC
</p>
        <p>
Castle Windsor could also be said to have been a major influence in Microsoft creating
their own Inversion of Control container, Unity. Unity is currently only under CTP,
but will be released, as Castle Windsor is, with an open licence and source code available.
There are a number of differences between Windsor and Unity, this document does not
discuss them, and instead recommends Windsor initially, with an option to move to
Unity should that need become apparent or viable in future – at present Unity
does not solve many of the scenarios we wish to cover.
</p>
        <h5>Licensing for Castle Windsor
</h5>
        <p>
It is released under the terms of Apache Software Foundation License 2.0 <sup>[9]</sup>,
which is possibly the most open of all licences. The Apache License (versions 1.0,
1.1, and 2.0) requires preservation of the <a href="http://en.wikipedia.org/wiki/Copyright">copyright</a> notice
and <a href="http://en.wikipedia.org/wiki/Disclaimer">disclaimer</a>, but it is not
a <a href="http://en.wikipedia.org/wiki/Copyleft">copyleft</a> license — it
allows use of the source code for the development of <a href="http://en.wikipedia.org/wiki/Free_software">free</a> and <a href="http://en.wikipedia.org/wiki/Open_source_software">open
source</a> software as well as <a href="http://en.wikipedia.org/wiki/Proprietary_software">proprietary
software</a>. Although lawyers can give you a legal list of restrictions this imposes,
it fundamentally comes down to “do what you want with it as long as the copyright
notice remains”
</p>
        <h5>What is the Support Behind Castle Windsor?
</h5>
        <p>
As an open source project, Castle Windsor could be said to be one of the most mature
and continually developed projects around. Although officially at RC3 for a large
number of months so far, this is mainly due to a project requirement that version
1.0 will not be released until the external API can be guaranteed to be stable.
</p>
        <p>
On a daily basis, Castle Windsor can be considered highly stable, and is being constantly
developed. The few bugs that are present are resolved rapidly, and there is commercial
support available should that be a requirement – though with full access to
the source code this would appear unnecessary.
</p>
        <p>
[1] Robert C Martin : 
<br /><a href="http://www.objectmentor.com/resources/articles/Principles_and_Patterns.pdf">http://www.objectmentor.com/resources/articles/Principles_and_Patterns.pdf</a><br />
[2] Robert C martin : 
<br /><a href="http://www.objectmentor.com/resources/articles/srp.pdf">http://www.objectmentor.com/resources/articles/srp.pdf</a><br />
[3] Wikipedia : 
<br /><a href="http://en.wikipedia.org/wiki/Separation_of_concerns">http://en.wikipedia.org/wiki/Separation_of_concerns</a><br />
[4] Robert C Martin : 
<br /><a href="http://www.objectmentor.com/resources/articles/dip.pdf">http://www.objectmentor.com/resources/articles/dip.pdf</a><br />
[5] Wikipedia : 
<br /><a href="http://en.wikipedia.org/wiki/Inversion_of_control">http://en.wikipedia.org/wiki/Inversion_of_control</a><br />
[6] Wikipedia : 
<br /><a href="http://en.wikipedia.org/wiki/Unit_testing">http://en.wikipedia.org/wiki/Unit_testing</a><br />
[7] Wikipedia : 
<br /><a href="http://en.wikipedia.org/wiki/Test-driven_development">http://en.wikipedia.org/wiki/Test-driven_development</a><br />
[8] Castle : 
<br /><a href="http://www.castleproject.org/container/gettingstarted/index.html">http://www.castleproject.org/container/gettingstarted/index.html</a><br />
[9] Wikipedia : 
<br /><a href="http://en.wikipedia.org/wiki/Apache_license">http://en.wikipedia.org/wiki/Apache_license</a></p>
        <p>
 
</p>
        <p class="MsoNormal" style="margin: 0cm 0cm 10pt">
          <a href="http://en.wikipedia.org/wiki/Apache_license">
            <font face="Calibri" color="#800080" size="3">
            </font>
          </a>
        </p>
        <div class="wlWriterSmartContent" id="scid:d7bf807d-7bb0-458a-811f-90c51817d5c2:70b51c33-3665-43b1-af67-9144869d188b" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px">
          <p>
            <span class="TagSite">Technorati:</span>
            <a href="http://technorati.com/tag/design" rel="tag" class="tag">design</a>, <a href="http://technorati.com/tag/development" rel="tag" class="tag">development</a>, <a href="http://technorati.com/tag/architecture" rel="tag" class="tag">architecture</a>, <a href="http://technorati.com/tag/Castle+Windsor" rel="tag" class="tag">Castle
Windsor</a>, <a href="http://technorati.com/tag/Unity" rel="tag" class="tag">Unity</a>, <a href="http://technorati.com/tag/Inversion+of+Control" rel="tag" class="tag">Inversion
of Control</a>, <a href="http://technorati.com/tag/Seperation+of+Cconcerns" rel="tag" class="tag">Seperation
of Cconcerns</a>, <a href="http://technorati.com/tag/Dependency+Injection+Principle" rel="tag" class="tag">Dependency
Injection Principle</a><br /><!-- StartInsertedTags: design, development, architecture, Castle Windsor, Unity, Inversion of Control, Seperation of Cconcerns, Dependency Injection Principle :EndInsertedTags --></p>
        </div>
        <img width="0" height="0" src="http://blog.goinsane.co.uk/aggbug.ashx?id=0a480411-0789-4d75-91de-c5201c17ebca" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Stupid Error!!!!</title>
    <link rel="alternate" type="text/html" href="http://blog.goinsane.co.uk/2008/02/20/StupidError.aspx" />
    <id>http://blog.goinsane.co.uk/PermaLink,guid,9ecff7db-dc2b-44b3-b582-e45ecfd874b8.aspx</id>
    <published>2008-02-20T03:51:40.536-07:00</published>
    <updated>2008-02-21T01:27:43.3588969-07:00</updated>
    <category term="rants" label="rants" scheme="http://blog.goinsane.co.uk/CategoryView,category,rants.aspx" />
    <category term="ReSharper" label="ReSharper" scheme="http://blog.goinsane.co.uk/CategoryView,category,ReSharper.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
Something is locking me out of my assemblies ... after a clean Get Latest from TFS,
i go to a command prompt and run my MSBuild script ... it fails with errors reporting
it cannot delete the directory as it is not empty, and then proceeds to report a host
or errors updating assemblies as access is denied. If I then go back to Visual Studio
I get the following error for every project .... "Cannot analyze project output:"
</p>
        <p>
I don't  know if this is Visual Studio, TFS or ReSharper causing this but it
is annoying me to hell ... closing the solution lets me run MSBuild perfectly again
... anyone got any ideas?
</p>
        <p>
          <strong>UPDATE:</strong>  <em>Turns out that this is a ReSharper error certainly
present in 3.1 ... I found this out as the amazingly responsive ReSharper team took
a look at my post, and replied immediately admitting it was a bug of theirs. It also
turns out it was already fixed in version 4.x  but not in 3.x ... after a very
short whine by me to Ilya at JetBrains, he then dropped me back an email very soon
after telling me the changes had been back ported into the 3.x build, and would appear
there from the next nightly build. Now that is responsive!</em></p>
        <p>
          <em>Suffice to say, and good to their word, the error is no longer present ... Yippppeeee!!!!!</em>
        </p>
        <p>
          <em>Thanks for the many suggestions I had to try and pin this down!</em>
        </p>
        <img width="0" height="0" src="http://blog.goinsane.co.uk/aggbug.ashx?id=9ecff7db-dc2b-44b3-b582-e45ecfd874b8" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Evaluating Microsoft P&amp;amp;P Unity - Is there a case for using it over Castle Windsor?</title>
    <link rel="alternate" type="text/html" href="http://blog.goinsane.co.uk/2008/02/20/EvaluatingMicrosoftPampPUnityIsThereACaseForUsingItOverCastleWindsor.aspx" />
    <id>http://blog.goinsane.co.uk/PermaLink,guid,0df320a0-2587-4403-979e-4795a880949e.aspx</id>
    <published>2008-02-20T00:12:13.3163553-07:00</published>
    <updated>2008-02-20T00:13:17.2159761-07:00</updated>
    <category term=".NET" label=".NET" scheme="http://blog.goinsane.co.uk/CategoryView,category,.NET.aspx" />
    <category term="Agile" label="Agile" scheme="http://blog.goinsane.co.uk/CategoryView,category,Agile.aspx" />
    <category term="Castle" label="Castle" scheme="http://blog.goinsane.co.uk/CategoryView,category,Castle.aspx" />
    <category term="rants" label="rants" scheme="http://blog.goinsane.co.uk/CategoryView,category,rants.aspx" />
    <category term="Testing" label="Testing" scheme="http://blog.goinsane.co.uk/CategoryView,category,Testing.aspx" />
    <category term="Unity" label="Unity" scheme="http://blog.goinsane.co.uk/CategoryView,category,Unity.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
OK, so I figure it's 6am - in the interests of personal education, and possible improvement
of my framework for my client, I decide I best get down and dirty with <a href="http://www.codeplex.com/unity/" target="_blank">Unity</a> and
see how simple it is to replace <a href="http://www.castleproject.org/container/index.html" target="_blank">Windsor</a> in
our current application.  If it is simple, and it makes the application simpler,
then I'll go the <a href="http://www.codeplex.com/unity/" target="_blank">Unity</a> route
(as a MS fanboi I really do prefer the MS option where all other factors are equal).
Some debate on <a href="http://tech.groups.yahoo.com/group/altdotnet/" target="_blank">altdotnet</a> made
me consider my position on it.
</p>
        <p>
Unity is roughly comparable to IoC containers like Windsor and StructureMap, the <a href="http://www.codeplex.com/" target="_blank">CodePlex</a> site
description says:
</p>
        <blockquote>
          <p>
            <em>The Unity Application Block (Unity) is a lightweight extensible dependency injection
container with support for constructor, property, and method call injection.</em>
          </p>
        </blockquote>
        <p>
So ... I download the project from <a href="http://www.codeplex.com/" target="_blank">CodePlex</a> ...
and double click the solution file ... 
</p>
        <p>
I only have VS2008 Development Edition on this laptop, no VS2005, so a conversion
is required. OK - I have done this before - it should work right, after all <a href="http://www.codeplex.com/" target="_blank">CodePlex</a> says: 
</p>
        <blockquote>
          <p>
            <em> You can modify or extend the Unity Application Block using Visual Studio 2008.
When you open a solution, Visual Studio 2008 will upgrade the projects to its format
and you can edit and compile the code to create assemblies targeted at version 3.0
of the .NET Framework. However, you will not be able to convert the projects back
into Visual Studio 2005 format. Therefore, it is a good idea to work with a copy of
the original solutions and projects. </em>
          </p>
        </blockquote>
        <p>
Guess what ... the conversion fails. Well mostly it works, but all of the Unit Test
projects fail to convert. Come on MS ... these are your things ... your IDE, your
conversion wizard, your <a href="http://www.codeplex.com/" target="_blank">CodePlex</a> project,
and your unit testing framework - this is not rocket science. 
</p>
        <p>
OK - I'll give you a little leeway as Unity is a CTP ... 
</p>
        <p>
So I close it down after struggling a little with the sample applications when I don't
have unit tests to read (more on the sample apps shortly). Go and read <a href="http://www.codeplex.com/" target="_blank">CodePlex</a> for
20 mins to try and see if anyone has these problems, but with no luck. 
</p>
        <p>
I brace myself to figure this stuff out without unit tests, and double click the solution
again. It now tells me it needs to do a conversion. Deja Vu moment ... surely I just
converted it already ... maybe I was dreaming. I tell it to do the conversion, and
bingo it converts successfully, including all the unit test projects it failed to
convert 20 minutes ago. 
</p>
        <p>
Inconsistent behaviour annoys me ... either fail to convert every damn time, or work
every damn time, but don't pick and choose based on some ethereal criteria I am unaware
of! 
</p>
        <p>
Right ... I have a full solution loaded ... lets compile this and see it fly ... 
</p>
        <p>
Nice idea ... except VS thinks otherwise ... all references to using <em>Microsoft.VisualStudio.TestTools.UnitTesting</em> are
showing red in the test projects. All references are broken ... they point to <em>Microsoft.VisualStudio.QualityTools.UnitTestFramework</em> correctly,
but they show pointing to version 0.0.0.0 which I guess is the VS2005 reference misbehaving
in VS2008 ... so I have to manually update each reference, either by changing the <em>"Specific
Version"</em> property to false in which case it auto picks the version 9.0 assembly,
or by removing the reference and re-adding it (and we all know how tedious that is
to do). 
</p>
        <p>
Why????? Why make me go through all this to see Unity, when every tool I was using
was from MS ??? 
</p>
        <p>
I understand it isn't entirely the fault of the Unity team here, but surely you guys
are in the best possible position to know about the way each others products work. 
</p>
        <p>
I choose MS products because I expect them to *just work* out of the box ... I choose
certain OSS products expecting them to not be packaged as nicely, or as well documented,
and expect a few niggles. 
</p>
        <p>
So I have wasted at least 30 minutes on <a href="http://www.codeplex.com/unity/" target="_blank">Unity</a> already,
and haven't read any code. Please Microsoft, make your things play nicely with each
other ... is that too much to ask? 
</p>
        <p>
Right ... off to actually see how Unity works, and how it can make my life easier
now ... 
</p>
        <p>
 
</p>
        <div class="wlWriterSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:61dc57b8-930a-4e26-bf9a-9fd63ad21fbd" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px">Technorati
Tags: <a href="http://technorati.com/tags/Unity" rel="tag">Unity</a>,<a href="http://technorati.com/tags/Windsor" rel="tag">Windsor</a>,<a href="http://technorati.com/tags/IoC" rel="tag">IoC</a>,<a href="http://technorati.com/tags/CodePlex" rel="tag">CodePlex</a>,<a href="http://technorati.com/tags/Visual%20Studio%202008" rel="tag">Visual
Studio 2008</a></div>
        <img width="0" height="0" src="http://blog.goinsane.co.uk/aggbug.ashx?id=0df320a0-2587-4403-979e-4795a880949e" />
      </div>
    </content>
  </entry>
  <entry>
    <title>ReSharper 4 - Soon ... Very Soon ...</title>
    <link rel="alternate" type="text/html" href="http://blog.goinsane.co.uk/2008/02/16/ReSharper4SoonVerySoon.aspx" />
    <id>http://blog.goinsane.co.uk/PermaLink,guid,8e14aff0-0a19-4f37-a447-c59b52f37d18.aspx</id>
    <published>2008-02-16T02:50:02.0372669-07:00</published>
    <updated>2008-02-16T02:51:45.8028919-07:00</updated>
    <category term=".NET" label=".NET" scheme="http://blog.goinsane.co.uk/CategoryView,category,.NET.aspx" />
    <category term="Agile" label="Agile" scheme="http://blog.goinsane.co.uk/CategoryView,category,Agile.aspx" />
    <category term="ReSharper" label="ReSharper" scheme="http://blog.goinsane.co.uk/CategoryView,category,ReSharper.aspx" />
    <category term="Testing" label="Testing" scheme="http://blog.goinsane.co.uk/CategoryView,category,Testing.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
The nightly builds are up: 
<br />
 <a title="http://www.jetbrains.net/confluence/display/ReSharper/ReSharper+4.0+Nightly+Builds" href="http://www.jetbrains.net/confluence/display/ReSharper/ReSharper+4.0+Nightly+Builds">http://www.jetbrains.net/confluence/display/ReSharper/ReSharper+4.0+Nightly+Builds</a>  
</p>
        <p>
There are some notes on what is new, and what is fixed at: 
<br /><a title="http://www.jetbrains.net/confluence/display/ReSharper/ReSharper+4.0+EAP+Notes" href="http://www.jetbrains.net/confluence/display/ReSharper/ReSharper+4.0+EAP+Notes">http://www.jetbrains.net/confluence/display/ReSharper/ReSharper+4.0+EAP+Notes</a> 
</p>
        <p>
... I can't wait to try it out ... looks yummy :)
</p>
        <div class="wlWriterSmartContent" id="scid:d7bf807d-7bb0-458a-811f-90c51817d5c2:2fb8c655-baf4-4c1a-ab38-b752e50914db" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px">
          <p>
            <span class="TagSite">Technorati:</span>
            <a href="http://technorati.com/tag/ReSharper" rel="tag" class="tag">ReSharper</a>
            <br />
            <!-- StartInsertedTags: ReSharper :EndInsertedTags -->
          </p>
        </div>
        <img width="0" height="0" src="http://blog.goinsane.co.uk/aggbug.ashx?id=8e14aff0-0a19-4f37-a447-c59b52f37d18" />
      </div>
    </content>
  </entry>
  <entry>
    <title>TeamCity on a Clean Build CI Server</title>
    <link rel="alternate" type="text/html" href="http://blog.goinsane.co.uk/2008/01/28/TeamCityOnACleanBuildCIServer.aspx" />
    <id>http://blog.goinsane.co.uk/PermaLink,guid,5623f414-60ac-464f-8fb9-22bd530dd904.aspx</id>
    <published>2008-01-28T11:32:32.62-07:00</published>
    <updated>2008-01-29T01:43:35.8570391-07:00</updated>
    <category term=".NET" label=".NET" scheme="http://blog.goinsane.co.uk/CategoryView,category,.NET.aspx" />
    <category term="Agile" label="Agile" scheme="http://blog.goinsane.co.uk/CategoryView,category,Agile.aspx" />
    <category term="Code Coverage" label="Code Coverage" scheme="http://blog.goinsane.co.uk/CategoryView,category,Code%2BCoverage.aspx" />
    <category term="Continuous Integration" label="Continuous Integration" scheme="http://blog.goinsane.co.uk/CategoryView,category,Continuous%2BIntegration.aspx" />
    <category term="Development" label="Development" scheme="http://blog.goinsane.co.uk/CategoryView,category,Development.aspx" />
    <category term="NCover" label="NCover" scheme="http://blog.goinsane.co.uk/CategoryView,category,NCover.aspx" />
    <category term="TeamCity" label="TeamCity" scheme="http://blog.goinsane.co.uk/CategoryView,category,TeamCity.aspx" />
    <category term="Testing" label="Testing" scheme="http://blog.goinsane.co.uk/CategoryView,category,Testing.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
Today I wanted to setup <a href="http://www.jetbrains.com/" target="_blank">JetBrains</a><a href="http://www.jetbrains.com/teamcity/">TeamCity</a> as
a pilot to run <a href="http://en.wikipedia.org/wiki/Continuous_Integration">continuous
integration</a> for us.
</p>
        <p>
With their new licencing model, TeamCity is free for up to 20 build configurations,
3 build agents and 20 users, which is more than enough for us to get going and see
if it improves our process.
</p>
        <p>
Other options were <a href="http://msdn2.microsoft.com/en-us/library/ms181710(VS.80).aspx">Team
Foundation Build</a> or <a href="http://confluence.public.thoughtworks.org/display/CCNET/Welcome+to+CruiseControl.NET">CC.Net</a></p>
        <p>
Personally I discounted Team Build early, various comments on mailing lists and forums
made it very clear that it was far from being a CI server out of the box, and although
after some apparently extensive configuration it could be made to do something similar,
it is far from a friction free piece of software.
</p>
        <p>
CC.Net I have used a number of times before, but the XML configuration it requires
is less than joyous, and no matter how often I set it up, I never seem to get quicker
at it. Good it may be, easy to configure it isn't.
</p>
        <p>
So we decided to start off with a clean Windows 2003 Server installation, as it comes
out of the box. That meant that we didn't even install IIS, as TeamCity includes Tomcat
to serve up its dashboard.
</p>
        <p>
We had a few teething problems, but the installation was up and running inside a few
short minutes ... albeit not building.
</p>
        <p>
The first problem was rather major - under the VCS settings in TeamCity we had opted
for Team Foundation Server, and given it all the settings we knew to be correct -
but it repeatedly gave us an obscure error - one with no information other than a
java exception:
</p>
        <blockquote dir="ltr" style="MARGIN-RIGHT: 0px">
          <p>
            <font size="1">
              <em>jetbrains.buildServer.vcs<wbr />.VcsException: TFS execution error</em>
            </font>
            <br />
            <em>
              <font size="1">Stdout: 
<br />
TFS Native Verifier v1.0 Copyright (C) 2006-2007 JetBrains s.r.o. by Mikhail Pilin
and Eugene Petrenko 
<br />
Stderr: 
<br />
Exception: 
<br />
at jetbrains.buildServer.buildTrig<wbr />gers.vcs.tfs.TfsNativeExeRunner<wbr />.start(TfsNativeExeRunner.java:20)</font>
            </em>
          </p>
        </blockquote>
        <p>
We spent a fair while on this, eventually giving in and dropping an email to JetBrains
- all credit to Serge there for a quick response. After a few confusing emails backwards
and forwards, the first solution they could suggest was that I needed a "full TFS"
install on the CI server.
</p>
        <p>
This wasn't a great solution - we were deliberately trying to keep the server clean,
the last thing I wanted was Visual Studio or Team Explorer installed.
</p>
        <p>
After a bit of searching around, and some helpful hints on the altdotnet mailing list,
I found that MS now package the <a href="http://www.codeplex.com/CodePlex/Wiki/View.aspx?title=Obtaining%20the%20Team%20Explorer%20Client">Team
Explorer as a download on its own</a>. This looked after unpacking to install some
kind of Visual Studio "light" which I still didn't want on the server - but after
drilling down I found the Microsoft.TeamFoundation.xxxx assemblies were included in
the package. I added these into the GAC, and the problem was instantly resolved without
an install of Team Explorer or Visual Studio. A very short while afterwards a clarification
came from JetBrains:
</p>
        <blockquote dir="ltr" style="MARGIN-RIGHT: 0px">
          <p>
            <em>To be more specific, the following components must be in PATH: 
<br /><br />
Microsoft.TeamFoundation<wbr />.Client.dll 
<br />
Microsoft.TeamFoundation<wbr />.Common.dll 
<br />
Microsoft.TeamFoundation<wbr />.Common.Library.dll 
<br />
Microsoft.TeamFoundation.dll 
<br />
Microsoft.TeamFoundation<wbr />.VersionControl.Client.dll 
<br />
Microsoft.TeamFoundation<wbr />.VersionControl.Common.dll 
<br />
Microsoft.TeamFoundation<wbr />.VersionControl.Common.Integra<wbr />tion.dll 
<br />
Microsoft.TeamFoundation<wbr />.WorkItemTracking.Client.Cache<wbr />.dll 
<br />
Microsoft.TeamFoundation<wbr />.WorkItemTracking.Client<wbr />.DataStore.dll 
<br />
Microsoft.TeamFoundation<wbr />.WorkItemTracking.Client.dll 
<br />
Microsoft.TeamFoundation<wbr />.WorkItemTracking.Client<wbr />.Provision.dll 
<br />
Microsoft.TeamFoundation<wbr />.WorkItemTracking.Client<wbr />.QueryLanguage.dll 
<br />
Microsoft.TeamFoundation<wbr />.WorkItemTracking.Client<wbr />.RuleEngine.dll 
<br />
Microsoft.TeamFoundation<wbr />.WorkItemTracking.Proxy.dll</em>
          </p>
        </blockquote>
        <p>
The GAC solution was therefore on the mark, but we may have got away with dropping
the assemblies in the path too. Either way - this was a much cleaner install.
</p>
        <p>
Our second problem was a silly mistake in configuring the project. We are using MSBuild
to do the building, and we kept getting a "MSBuild Schema could not be found" error.
After a lot of head bashing it turned out I had managed to click on the Validate option
in TeamCity, and it was TeamCity rather than MSBuild that was throwing the error -
TC could certainly do with better logging. The missing schema file could probably
have been dropped alongside the .build file, but as we didn't need it to be validated,
we unticked the option, and voila ... it all worked ... almost ...
</p>
        <p>
One last little niggle caught us, <a href="http://www.ncover.com/">NCover</a> was
timing out while running, and giving us an error regarding the profiler. We had included
NCover in our TFS tree, along with NUnit, Rhino, and all the other tools we need,
this was to avoid having to install anything on a workstation to be able to build
the projects.
</p>
        <p>
After a hint from Ayende, it turned out that NCover requires an assembly to be registered
with regsvr32, something I haven't done in so long, I had forgotten the command even
existed! So to solve this problem, the answer is:
</p>
        <blockquote dir="ltr" style="MARGIN-RIGHT: 0px">
          <p>
regsvr32 coverlib.dll
</p>
        </blockquote>
        <p>
It may not be ideal, but it does the job, and I think I can live with one assembly
needing to be registered, at least in the short term.
</p>
        <blockquote dir="ltr" style="MARGIN-RIGHT: 0px">
          <p>
            <strong>
              <em>Update:</em>
            </strong>
            <em>Grant Drake posted about this a while ago, and </em>
            <a href="http://www.kiwidude.com/blog/2007/04/ncover-problems-fixes-part-1.html">
              <em>has
4 possible solutions here</em>
            </a>
            <em> ... using //reg on the command line is a much
better option in a CI environment, so I'm switching our build to do that this morning.</em>
          </p>
        </blockquote>
        <p>
And with all that done, we now have a *very* clean CI server, running a very basic
Windows Server install, with a very neat TeamCity install.
</p>
        <p>
Now to show the business benefit!
</p>
        <p>
        </p>
        <div class="wlWriterSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:1fb60764-8629-4e39-be33-4680c45cd2df" style="PADDING-RIGHT: 0px; DISPLAY: inline; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-TOP: 0px">Technorati
Tags: <a href="http://technorati.com/tags/development" rel="tag">development</a>,<a href="http://technorati.com/tags/continuous%20integration" rel="tag">continuous
integration</a>,<a href="http://technorati.com/tags/TeamCity" rel="tag">TeamCity</a>,<a href="http://technorati.com/tags/ncover" rel="tag">ncover</a>,<a href="http://technorati.com/tags/Team%20Foundation%20Server" rel="tag">Team
Foundation Server</a>,<a href="http://technorati.com/tags/TFS" rel="tag">TFS</a></div>
        <p>
        </p>
        <p>
        </p>
        <div class="wlWriterSmartContent" style="PADDING-RIGHT: 0px; DISPLAY: inline; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-TOP: 0px">
          <hr height="1" />
        </div>
        <p>
        </p>
        <img width="0" height="0" src="http://blog.goinsane.co.uk/aggbug.ashx?id=5623f414-60ac-464f-8fb9-22bd530dd904" />
      </div>
    </content>
  </entry>
</feed>