I was taking one of the OCMJEA mock tests, and came across this question:
Q. ABC Inc. is building a
J2EE based application for Order Entry and Management. 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
I answered Mediator, since it promotes loose coupling by keeping objects from referring to each other. That is what JMS on MQSeries is doing here.
But the correct answer, as per the
test authors, states it is Bridge pattern where JMS is abstraction and MQ series could be the implementation. The explanation only quotes the GoF definition of the patterns in options.
Could someone please help me understand, how is Mediator pattern wrong here ? (There is only one correct answer to this question)
Thanks.