• 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

OCMJEA Mock Question - Design Patters

 
Greenhorn
Posts: 4
Oracle Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
author
Posts: 42
1
Eclipse IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Mayank,

This question is pretty vague. I was intrigued by it and looked up in Google. It turned out the same question was asked long time ago in this forum:
https://coderanch.com/t/154350/java-Architect-SCEA/certification/Design-Pattern-vague

I think that yes, JMS can be an example of a bridge, and overall, the question is talking about the Observer pattern, but again, the question doesn't present us enough elements, we can choose Bridge by discarding all the other answers.

About the mediator pattern, this pattern uses an objet to coordinate all the communication among other objects. These objects don't communicate directly with each other, instead, they communicate through the mediator object. In this case, the question doesn't refer to a mediator object.
 
Mayank Sinha
Greenhorn
Posts: 4
Oracle Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Esteban

Thanks for your clarification about mediator pattern. And yes, this question is very vague, does not present enough information to choose a right answer or discard the close but wrong ones.

I found some posts on this question on this forum and others as well, but could not find a definite answer anywhere. I guess it's better to move on and hope such questions do not find place in actual OCMJEA tests

Thanks
Mayank
 
Mayank Sinha
Greenhorn
Posts: 4
Oracle Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Marking this as resolved, since Esteban has clarified why mediator is not the right option.
 
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The following page contains several diagrams along with an explanation for the
Mediator Pattern.
 
reply
    Bookmark Topic Watch Topic
  • New Topic