Inversion of Control and Testability

Scottish Developers
Thu, 19 Mar 2009, 18:30 - 20:30 (Add to calendar) GMT
Glasgow Caledonian University , Glasgow, GB

Talk Description

The architectural design pattern, Inversion of control (IOC) at last appears to be gaining some momentum in the .NET mainstream. Frameworks such as Castle Windsor, Autofac, Structuremap and Spring have given rise to the .NET IOC (inversion of control) container.

Robert C. Martin says in his article on the topic of dependency inversion, "High-level modules should not depend on low-level modules. Both should depend on abstractions." An abstraction in this context implies that dependency should be abstract class or an interface.

When dependencies are abstractions, it is easy to 'mock', 'fake' or 'stub' specific dependencies thus allowing you to simulate the output that a dependency may yield. Such an example of mocking or stubbing a dependency would allow you to mock-up the result of a data access layer (DAL) call. Such a fake allows you to unit test against guaranteed output without ever having to configure or read from a real database.

One way to manage your dependencies is to store them in an IOC (inversion of control) container. You can think of an IOC container in simple terms as a fancy dictionary of interfaces versus implementing types. Full blown IOC containers offer many other benefits including lifetime management and auto-wiring.

This talk aims to convince that side effects of both designing for testability and the use of an inversion of control container can lead to more maintainable software, cleaner code and push architects towards good design principles such as 'separation of concerns' (SOC).

Speaker Biography

Colin Gemmel is a Web/Application Developer working in the Medical Faculty of Glasgow University for the past 3 years. An avid follower of agile principles and practices he is always happy to pass on his views of software development to anyone that will listen. Colin is also a regular participant of the Scottish ALT.NET Community.


  • 18:00 Doors Open
  • 18:30 Welcome
  • 18:40 IoC
  • 19:30 Break
  • 19:40 IoC
  • 20:20 Feedback and Prizes
  • 20:30 Pub (back bar at Waxy O'Connor's on West George Street)


Room M127 of the George Moore Building at Glasgow Caledonian University, Cowcaddens Road, Glasgow G4 0BA

You might also like...


Other nearby events



Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Weeks of coding can save you hours of planning.”