Oct. 09 22:43~23:29
Provide a unified interface to a set of interfaces in a subsystem. Facade defines a higher-level interface that makes the subsystem easier to use.
第一句話「Provide a unified interface to a set of interfaces in a subsystem」感覺像是solution，第二句話「Facade defines a higher-level interface that makes the subsystem easier to use」可以「聞到」一點點Problem的味道--就從這一句makes the subsystem easier to use改寫成第一版的Problem吧。
Problem：How do you use a subsystem?
Structuring a system into subsystems helps reduce complexity. A common design goal is to minimize the communication and dependencies between subsystems. One way to achieve this goal is to introduce a facade object that provides a single, simplified interface to the more general facilities of a subsystem.
Force 1: You want to reduce dependencies between the subsystem and its client so that when the subsystem changes, the client will not be affected.
Consider for example a programming environment that gives applications access to its compiler subsystem. This subsystem contains classes such as Scanner, Parser, ProgramNode, BytecodeStream, and ProgramNodeBuilder that implement the compiler…(省略)
To provide a higher-level interface that can shield clients from these classes, the compiler subsystem also includes a Compiler class. This class defines a unified interface to the compiler's functionality. The Compiler class acts as a facade…(省略)
- you want to provide a simple interface to a complex subsystem. Subsystems often get more complex as they evolve. Most patterns, when applied, result in more and smaller classes. This makes the subsystem more reusable and easier to customize, but it also becomes harder to use for clients that don't need to customize it. A facade can provide a simple default view of the subsystem that is good enough for most clients. Only clients needing more customizability will need to look beyond the facade.
- there are many dependencies between clients and the implementation classes of an abstraction. Introduce a facade to decouple the subsystem from clients and other subsystems, thereby promoting subsystem independence and portability.
- you want to layer your subsystems. Use a facade to define an entry point to each subsystem level. If subsystems are dependent, then you can simplify the dependencies between them by making them communicate with each other solely through their facades.
Problem: How do you use a subsystem?
- You want to reduce dependencies between the subsystem and its clients so that when the subsystem changes, the clients will not be affected.
- The subsystem should be as easy-to-use as possible.
不曉得鄉民們有沒有發現，Teddy在找Force的時候是先從比較簡單的pattern開始找起…XD，等哪一天GoF的23個pattern的Force第一版都整理好之後，就可以準備著手開始規劃《設計模式的逆襲》了。不過今天下午和指導教授聊了一下天，又再度被宣導「Problem Frame」的好處，讓Teddy有點小分心想要「轉台」到Problem Frame這個議題上面…Orz。今天原本是想要介紹Problem Frame的，後來想了一下，還是先幫Design Pattern「集氣」一下，不然太發散的話事情真的都要做不完拉。
友藏內心獨白：不過Problem Frame還是要找時間好好整理一下，對Product Owner的訓練會很有幫助滴。