The difference of adapter pattern and bridge pattern

Posted on 2009-05-31 16:42  名号M  阅读(269)  评论(0)    收藏  举报

Adapter pattern define an object that is only an adapter of a fridge, a PC, a radio or something else. It isn't care about the entity's status. Or we can say when the entity is defined, the status is fixed. We cannot set its status.

Bridge pattern first define an object, and then set its status. The object can be a bridge of a light, a radio, an electric fan. It's not only care about what the entity is, but also the entity's status(on or off).

To sum up, adapter pattern is suitable for one dimension of vary, whereas bridge pattern is for two or more dimension of vary.

博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3