mardi 21 juin 2016

Software Design: DI - multiple assemblies + non public types

My first post here so hello all :)

I'm using stairway pattern e.g. I have Assembly A (entry point - composition root) which depends on Assembly B (containing interfaces) and Assembly C which contains implementations of interfaces defined in Assembly B:

A --> B <-- C

I'm developing in C# and I'm using Castle Windsor for IoC.

I'm also utilizing Windsor's ability to register non public types (http://ift.tt/28R2omR -> Registering Non Public Types). I found it useful as I can define classes in assembly C to be internal which means that no one would create direct dependency on C from A. This way both A and C only depend on Assembly B which contains only abstractions which sounds right to me.

I'm wondering though if this is a good design choice. As far as I'm aware only Windsor allows to register non public types and they also warn to not expose non public types, hence my question. Also, I don't think this considerations is limited to .NET world so I'll appreciate insight into this problem regardless of technology you use :)

Aucun commentaire:

Enregistrer un commentaire