Andrew Flanagan
Andrew Flanagan

Reputation: 4277

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 parameters, 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?

Upvotes: 0

Views: 350

Answers (1)

Robert Levy
Robert Levy

Reputation: 29073

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

Upvotes: 1

Related Questions