Loose Coupling of Components
Posted
by David
on Stack Overflow
See other posts from Stack Overflow
or by David
Published on 2010-05-20T19:01:05Z
Indexed on
2010/05/20
19:10 UTC
Read the original article
Hit count: 292
I have created a class library (assembly) that provides messaging, email and sms. This class library defines an interface IMessenger which the classes EmailMessage and SmsMessage both implement.
I see this is a general library that would be part of my infrastructure layer and would / can be used across any development.
Now, in my application layer I have a class that requires to use a messaging component, I obviously want to use the messaging library that I have created. Additionally, I will be using an IoC container (Spring.net) to allow me to inject my implementation i.e. either email or sms.
Therefore, I want to program against an interface in my application layer class, do I then need to reference my message class library from my application layer class?
Is this tightly coupling my application layer class to my message class library?
Should I be defining the interface - IMessenger in a seperate library?
Or should I be doing something else?
© Stack Overflow or respective owner