"...for asynchronous communication A communicates with B using JMS and MQSeries. Which design pattern describes the use of JMS the best."
Possible answers amongst others: Mediator or Bridge
I thought it's Mediator but the correct answer is Bridge.
Thinking about it, it makes total sense since some J2EE APIs such as JDBC, JNDI and JMS use the bridge patterns to bridge to the providers implementation. However, Mediator does exactly what JMS does: "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 it lets you vary their interaction independently."
So which one is more correct? Mediator or Bridge?
Post by:Byron Estes
Bridge Decouple an abstraction from its implementation so that the two can vary independently
Mediator 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 it lets you vary their interaction independently.
* Definitions are from "Elements of Reusable Object-Oriented Software" - Gof4
I agree with you that JMS exhibits some of qualities of a Mediator, but it also exhibits qualities from a number of other patterns too.
The key here is that JMS can sit over top of any number of implementations. They mention MQSeries, but it could be SonicMQ or any other product that provides message queing.
JDBC is a bridge too...You've probably even heard people refer to the JDBC/ODBC bridge, right.
There is no doubt that these questions can be tricky. They are intentionally made to be so. When I took the exam I can remember marking half a dozen that I had to go back to after I finished all the others and try to second guess what they were asking or what tricks they were trying to play. I changed a few and got lucky, I had a 100% on Part I. Keep on doing the mock exams. I went through a lot of them. Keep questioning the answers, it helps you to more fully understand the subject matter.
Good luck! [ May 11, 2005: Message edited by: Byron Estes ]
Post by:David Follow
thanks a lot for your reply. Can you please list some of the "useful" mocks that you did. Ideally the ones that are close to the real thing - if such a mock exists at all...
Post by:vu lee
MQSeries also exhibits some characteristics of mediator too. JMS provides contract that others have to fulfill. Therefore, the preferable answer is bridge.
Post by:Byron Estes
I wish I could help you out, but I did my cert about 2 years ago and I didn't keep all that stuff.
I know there is a company that at the time had a nice little mock test program that I used in beta (...they asked me to review their software/questions and provid comment).
I believe it was WhizLabs. If they are still doing it, they should have improved it greatly by now. You might want to check it out.
Post by:Jeremy Hsu
I think the key thing that you have to understand is this.
JMS is a specification (JMS is an specification that defined by Sun. It consists of only API. The implementation is left to third party.)
MQSeries is an implementation of JMS
Therefore, bridge is definitely the choice
[ May 17, 2005: Message edited by: Jeremy Hsu ] [ May 17, 2005: Message edited by: Jeremy Hsu ]
Beware the other head of science - it bites! Nibble on this message:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database