I listened today an interesting podcast related to event based systems and one aspect especially caught my attention: how an event based architecture is a good cadidate for test driven development.
You can find this podcast on DotNetRocks: "Ted Faison takes events to the limit" and the speaker is Ted Faison.
So first interesting point is the difference Ted makes between events based architectures and event driven architectures. Ted describes event driven applications as applications that react to events and therefore whose inputs are events but events are not necessarily used as a core design element of the application. With no events fired, event driven applications are just idle. On the other hand event based applications are applications that are architected and designed with events as a core technique to inter-connect application components. Events in event based architectures are really a first class citizen, design element of the system.
An interesting point is that in a properly designed event based architecture, the inner components of a system are loosely coupled, and you can even imagine changing connexion between components, either statically through configuration, or dynamically at runtime. And high level loss coupling in software architecture is definitely a high goal to aim at.
To design an event based applications, and enforce the components lose coupling and ability to map and inter-connect components in a configurable way, well approved patterns exists to do that, so an event based applications will most probably integrate patterns like builders, binders and coordinators. For instance, to achieve the highest level of loose coupling, neither the receiver of the event nor the emitter of the event should know of each other; and to achieve that, a binder component would have the responsibility to wire and connect the components.
So here we come to the very interesting part of Ted's talk: event based architectures are by essence well suited to test driven applications due to the lose coupling aspect they promote: you can imagine testing single components of your applications without having to bring up the whole application including databases, web context and all expensive or difficult to test resources. And to not bring the whole application up, the only thing you have to do is to simply not connect the components; or to connect to mock up components instead for testing purposes.
And it is commonly understood and approved now that TDD development is a very good practice to build robust, maintainable and flexible systems, even though quite often proving to be a big challenge. Go event based and you have a good starting point! I am personally using dependency injection patterns to build the loose coupled application architectures + dynamic mocking framework for test driven development (more on this on other posts). Event based architecture is another interesting strategy to achieve the same, while having its own advantages and draw-backs. So up to you to decide on one, or maybe any other alternative!
So as a conclusion, I must say that Ted Faison's podcast was very compelling and convincing and an enjoyable listening session, presenting a deep look on amazing possibilities open by using events! It could worth having a look at Ted's book now: Events based programming: Taking events to the limit.
Recent Comments