开发者

Using Adapters with a Facade

My architecture previously was using a facade to perform a number of tasks through a simple set of methods. Something like:

startComputer(...)
shutdownComputer(...)

As I expand the application, I have the need to translate multiple types of input to the facade itself. Let's say that in the past startComputer took 6 parameter开发者_如何学运维s, and in the new architecture it takes some sort of parseable string input, and in another case, some base-64 encoded mess. Basically, across the board, I want to access the same sub-system through high-level commands, but define interfaces that take all sorts of formats.

I get confused when I start thinking about adapters vs. facades -- maybe especially because people are always delineating the differences. In this case, what I essentially want (I think) is to make adapters to support various inputs while keeping the facade as is. In this case, the facade is the adaptee.

Does this make sense or is there a better way?


sounds like you want your facade to use the "command" pattern to define it's parameters http://en.wikipedia.org/wiki/Command_pattern

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜