SCSF. Chapter 3. A. Problem Background

Problem Background

Solution Architecture

WorkItem Details

Controllers

Chapter 3 Lab Exercises WorkItems and Controllers

A. Problem Background

The term loosely, as in loosely coupled applications, doesn't mean neglected or badly. A loose coupling mechanism needs as much careful thought and design as a tight one, perhaps even more. For example, how does an object that wants to display a view obtain 获得 a reference to the workspace in which the view should be shown? How does a subscriber to a CAB event discover which events are available and enter a new subscription? And how does code that wants to modify the contents of the main menu and toolbar find the locations at which these modifications are allowed and obtain a reference to the objects that perform these modifications? These are the sorts of problems that our loose coupling mechanism needs to solve.

loosely这个术语,在松耦合程序中,不意味着未被好好照顾或者不好的。松耦合机制比一个紧的需要更多的顾虑,甚至更多。例如,一个需要显示view的对象如何从workspace中获得哪个view需要被引用?一个CAB事件的订阅者如何知道哪些事件时可用的并获得一个新的订阅?这些都是松耦合机制需要解决的问题。

This problem is similar 相似的 to the dead-drop communication strategies 策略 so often used in espionage novels. The two parties don't want to know each other directly (so as to)以至于 allow easy replacement of either party with a new one that provides the same services. So, instead of meeting directly, the sending party writes a message and, at a specified time, puts it in a location agreed upon对取得一致意见 in some out-of-band传输层协议使用带外数据 specification规格. The receiving party checks that location when its circumstances 情况 allow and retrieves 恢复/取得 the message.

这个问题有点像间谍小说里的秘密情报点的通讯策略。两部分不想直接知道对方,以至于可以简单的替换为一个提供相同服务的新的部分。所以,替代直接会面,发送方编写了一个消息,在一个指定的时间,放在一个双方取得一致意见的地方并使用out-of-band规格。接收方检查位置并获取信息。

That's the sort of thing that we need to do in our loosely coupled applications. The code that creates a workspace needs to place it into a standardized 标准的location so that the code that uses the workspace can find it. The creator code doesn't know or care who will consume 消费 it, and the consumer 消费者 code doesn't know or care who created it.

这就是我们在松耦合程序中需要做的事情。代码创建了一个workspace并把它放到一个标准的地方,以至于需要使用workspace的代码可以知道它。创建的代码不知道或关心谁要消费它,消费者代码也不知道或关系谁创建的它。

Loosely coupled applications need a standardized mechanism that allows creators of resources to place those resources into locations where their consumers can find them and where consumers can go to find resources placed by their creators, with neither party needing to have direct knowledge of the other.

松耦合程序需要一个标准的原则可使得创建者把资源放在消费者可以找到的地方,并不需要直接的知识。

posted @ 2017-02-15 11:59  plovjet  阅读(74)  评论(0)    收藏  举报