我知道松耦合和紧密耦合的信息。但是,我暂停何时可以决定何时何地使用?我不明白我什么时候需要松散耦合和紧密耦合?我什么时候需要紧耦合和松耦合?
看看请:http://www.dofactory.com/Patterns/PatternAdapter.aspx#_self1
如果你看看适配器类:
///
/// The 'Adapter' class
///
class Adapter : Target
{
private Adaptee _adaptee = new Adaptee();
public override void Request()
{
// Possibly do some other work
// and then call SpecificRequest
_adaptee.SpecificRequest();
}
}
以上使用像紧密耦合!我认为紧密耦合是不好的用法。但适配器模式使用紧密耦合。当我需要紧密和松散耦合?
紧耦合类变成一个不好的设计,如果你的应用程序的增长作为企业级应用程序。要了解您可以通过微软引用PRISM(或复合应用程序块)。这是一种使用松散耦合类的设计。 –