Monday 29 November 2010

Take It To Systest

One of the things I want to try to change at my current work place is to increase the level of developer responsibility when it comes to acceptance testing.  What hapens at the moment is a pair of develoers will pick up a card, work on it by writing unit tests and acceptance test then at some point they will decide it's 'done'.  At this point it will be 'pushed' to systest for testing by QA.  Inevitably some issues will be found and the work will be handed back to development, where it will wait to be picked back up again.

What I would like see is one of the two developers working on the card to take ownership of the acceptance testing and to 'take it to systest' to be tested with the help of the QA team.  That way small bugs that are always found in testing can be sorted out straight away.  The development would eventually get a better understanding on how other people use their system, defects found in QA are ironed more quickly, thus improving project velocity.

Saturday 9 October 2010

PostSharp Collaborators

One of the things we've been working on recently is caching with Memcache.  Caching is a cross-cutting concern that we thought could be refactored into an aspect.  Thus making caching happen automatically with the small addition of an attribute.  We went down, what seemed, the obvious route of postsharp and duly made and aspect that took care of our caching needs.

The problem we had with our aspect was getting the instance of the cache into the aspect. Normally we would include this in the constructor as a collaborator.  Obviously we can't do that because the aspect needs an empty constructor.  So what are the options?
  1. Pass the instance into the method where the aspect is being used, then pull it out in the aspect by getting the method args. 
  2. Use a service locator/factory or some other mechanism to get hold of the instance.
We tried the first option and it wasn't particularly satisfactory, it looks like your passing something into the method that you're not using in that method call (exasperated by R# telling you you don't need it). Not ideal! So we went down the line of getting hold of the instance using a service locator.

Since we went live with I found out that Castle Windsor has some limited options for AOP, it's called an IoC Interceptor this gives you the ability to intercept every method call on an interface.  This is fine for what we have as all the interface calls require caching.