Now that Windsor 3 is released I can concentrate on some of my other ideas and projects. While working on one of them, called Cartographer, I encountered an interesting API design problem.
I have a class (a builder to be precise) that has a task of setting up a central object (an IMapper implementation) in Cartographer (If you’ve ever used Autofac, it is somewhat analogous to ContainerBuilder). What is interesting about it, is I have three goals for that class:
- Provide API for high level configuration and extension points that are universal to and intrinsic to any IMapper implementation.
- Provide API for low level configuration of the default IMapper implementation that the builder creates, that will meet the following criteria:
- Not force user to customize anything, as the default setup should be enough to get started in most cases.
- Allow users to easily swap/extend parts of the dependency chain of the default mapper.
- Work well and be natural both with and without IoC container .
- Be simple and discoverable to the users (and provide good Intellisense experience).
How would you design the API for this class?
Oh, and happy new year.
12-31-2011 2:07 AM