Monday, March 17, 2008

Quick svn trick

Here's a one liner to update svn with your local changes.


svn st |awk '/\?/{print "svn add " $2};/\!/{print "svn del " $2}' | sh


Sure there are problems with it... like if the filename has ? or ! in it, then it'll do the wrong thing, but it works for me, so I thought I'd share :)

Thursday, March 06, 2008

NDependency Injection: HasCollection Enforces Layered Architecture

I recently added a feature to NDependencyInjection called "HasCollection".

It lets you specify a set of subsystems that all provide the same interface and so can be viewed as a collection.

ISystemDefinition book = new SystemWiring();

book.HasCollection(Page1, Page2, Page2).Provides();


Here Page1, Page2, Page3 are all of type ISubsystemBuilder, which each define the wiring of a specific IPage.

You can only expose something from one of these subsystems if all subsystems implement it. This has the side-effect of enforcing Liskov's Substitution Principle.

At first this feels limiting, but it is leading us to better designs.

GitHub Projects