Interesting pattern to decouple application parts and for integrating with other apps

Udi Dahan has written about an interesting way to evolve loosely-coupled application. It’s a very interesting trick and we’re already using it in our applications. And we’re using it for a very similar scenario: allowing to application modules and infrastructure to step in and say what they have about configuration and bootstrapping.

For example, some modules can modify configuration of NHibernate’s SessionFactory. We have next interface:

public interface IConfigurationContributor
{
    void Process(string name, Configuration config);
}

And whoever wants to intervene in configuration of any SessionFactory is implementing it. When factory is build container is pulling all implementors of IConfigurationContributor and “runs” over all of them.

As a result – clean design and loosely coupled application parts…

Advertisement
  1. Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

Gravatar
WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.