wcsf

Why is there an option to create a separate class library for interfaces with business modules?


In wcsf, it is possible to make a business module with a separate class library just for interfaces, if I tick the relevant box/boxes.

What is the point in having a separate class library just for interfaces? Wouldn't this add unnecessary bloat to my project and create a high coupling between two class libraries? What would be wrong with storing the interfaces in the class library storing concrete classes?

Thanks.


Solution

  • The advantage to storing the interfaces in a separate class library is that it actually decouples the implementing and using class libraries. If the interfaces are with the concrete implementing classes, then you have

    ImplementingClasses.dll <--- ClientClasses.dll

    If you put the interfaces into a separate assembly, it's more like this:

    ImplementingClasses.dll ---> Interfaces.dll <--- ClientClasses.dll

    Notice how this removes the coupling between your client code and the implementation - this will allow your total application to use a configuration-based approach to locating the proper implementing classes.