I found this question here:
http://www.geocities.com/subra_73/SCEA_Practice_Questions.htm ----
31 Julia Fractals Inc. is building a
J2EE based application for Order Entry and management of their fractal software. Once the order is taken, it is submitted to a relational database. A provisioning system then queries data and makes appropriate calls to various subsystems using JMS on MQ Series. What design
pattern is JMS an example of here?
A Observer
B Mediator
C Adapter
D Bridge
E Visitor
Choice D is correct.
Bridge (GOF 151)"Decouple an abstraction from its implementation so that the two can vary independently." In this case JMS is the abstraction. The implementation could be MQ Series, TIBCO Rendezvous and Vitria Businessware. Hence choice D is correct.
Observer (GOF 293)"Define a one-to-many dependency between objects so that when one object changes state, all its dependents are notified and updated automatically." Hence choice A is incorrect.
Mediator (GOF 273)"Define an object that encapsulates how a set of objects interact. Mediator promotes loose coupling by keeping objects from referring to each other explicitly, and lets you vary their interaction independently." Hence choice B is incorrect.
Adapter (GOF 139)"Convert the interface of a class into another interface clients expect. Adapter lets classes work together that couldn't otherwise because of incompatible interfaces." Hence choice C is incorrect.
Visitor (GOF 331)"Represent an operation to be performed on the elements of an object structure. Visitor lets you define a new operation without changing the classes of the elements on which it operates." Hence choice E is incorrect.
----
My question is how can such a vague question have one correct answer? Contrary to the explanation above, I think Bridge is the wrong answer.
I would argue that JMS is an example of the Observer pattern here, since messages on the MOM are used to push out changes to other subsystems.
I could also argue that MOM is a mediator here, since it decouples various subsystems from each other. Instead of subsystem A knowing abt subsystem B and/or subsystem C, it just knows abt the JMS destination where it is supposed to publish its events! The MOM acts like a mediator here.
I may be wrong, but how does one tackle such questions on the exam?