• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Mock on JMS and Design Patterns

 
Ranch Hand
Posts: 223
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello all,

in a mock test I found the following question:

"...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?

D.
 
Ranch Hand
Posts: 313
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
David Follow
Ranch Hand
Posts: 223
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Byron,

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...

D.
 
Ranch Hand
Posts: 208
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
MQSeries also exhibits some characteristics of mediator too. JMS provides contract that others have to fulfill. Therefore, the preferable answer is bridge.
 
Byron Estes
Ranch Hand
Posts: 313
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
David,

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.
 
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
What are you doing? You are supposed to be reading this tiny ad!
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic