Win a copy of liveProject: Build an ML Recommender System this week in the Artificial Intelligence and Machine Learning forum!
  • 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
  • Paul Clapham
  • Ron McLeod
  • paul wheaton
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Liutauras Vilda
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Piet Souris
Bartenders:
  • salvin francis
  • Mikalai Zaikin
  • Himai Minh

Need help with Patterns

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Guys,

I came across this sample SCEA question and I would like you guys to help me with the answer. Also, please give an explaination why that answer is correct.

--------------------
Question : 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
---------------------

Makes me feel the answer is Adapter. But I am not sure. Let me know your thoughts.


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

makes appropriate calls to various subsystems

It's an Observer. Observer consists of Subject that has a list of Observers. When some event is triggered, this Subject iterates the whole list and invoke some method in each of Observers.
 
Sheriff
Posts: 67532
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"Naveen S", please check your private messages for an important administrative matter.
 
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, It is observer pattern. It observe calls from various sub-systems and receive data.
 
Ranch Hand
Posts: 413
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Yes, I agree to Observer. I think that is the perfect answer. But what about the Mediator. I feel its also closer answer.

Thanks
 
Ranch Hand
Posts: 1936
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think it's Adapter. The question asks pattern of JMS, don't get confused.
 
Naveen K Sinha
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I know its not Mediator. Should be either Observer or Adapter.

Here is the reason, why I think it might be adapter.

"A provisioning system then queries data and makes appropriate calls to various subsystems using JMS on MQ Series" -- This means the provisioning system cannot directly call the other subsystems. ie, no way to invoke the subsystems directly. The JMS is acting as a "Messaging Integration" scenario, the bridge between the provisioning system and the other subsystems ( Don't confuse with the word bridge, bridge pattern is something else). So, Adapter looks to be right choice.


Above logic is why I am saying it be Adapter. But as I am a newbie to Patterns, I need someone to validate this. Experts please help.

Thanks,
Naveen
 
Chaminda Amarasinghe
Ranch Hand
Posts: 413
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Hi All

If your power cable does not match to the wall socket then you use an adapter. That is the basis of adapter patter. In here, no hint about mismatching interfaces between main system and sub systems. So I think Adapter is not correct.

On other hand, generally Mediator acts as a middle man to couple of components. That reduces the coupling between components and add a new layer (mediator) in between components. Mediator responsible for message (dont be confused with JMS messages) handling between components. In here JMS does that. Thats the reason to Im arguing Mediator is also correct.

Thanks
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear all,

Recognise this question from the whizlabs SCEA 5 part I mock exams. Bridge pattern should be the correct answer.

Quote:

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 for instance MQ Series, TIBCO Rendevous, Vitra Busninessware.

Regards
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic