We should build systems more loosely coupled to achieve properties like robustness, resilience and scalability, Udi Dahan emphasizes in a presentation discussing how we can model our systems using more event-driven and asynchronous patterns and some of the challenges developers face when introducing these principles and patterns into development.
Udi, an architect focusing on distributed systems and creator of NServiceBus, in his experience has found that decisions about the appropriate architecture for a system often are made early on when architects and developers are envisioning a small and fundamentally simple system. However, as a system evolves, a larger and larger codebase tends to bring more coupling with it, sometimes ending with a system that is a hideous mess of tight coupling, a complex Big Ball of Mud.
A challenge for Udi is how to prevent systems from turning into this mess, with one of the most important part being to keep the coupling low. In order to do that we have to introduce patterns focusing on loose coupling early on in a project, introducing a fundamentally different architecture late in a project together with a refactoring into a more loosely coupled event-type system will be much more difficult.
Udi focuses in his presentation on the Publish – Subscribe pattern with a observation that when introducing this type of asynchronous communication he frequently finds the best place to be in the core business domain logic; it contains the most complex logic and will benefit the most going from one monolith of logic into smaller domains running asynchronously from each other. But he emphasizes that this is a decision not to be taken lightly, he too often see developers rush into these patterns and misapply them where they don’t make sense.
Loose coupling is for Udi a double-edge sword, the more you disconnect things, the more loosely coupled they become, the more opportunities of independent failures and bugs increases. The advantage is that if you make a change to some logic in one part the likelihood of breaking in other parts is very small; this is ultimately what helps project get done faster.
After his talk on architecture, Udi ends his presentation with a demo of the NServiceBus tooling framework.
NServiceBus is an open source licensed service bus for .NET, with a commercial license also available. The bus is also part of a larger service platform.