• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Need help with Patterns

 
Naveen K Sinha
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • 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
 
stanislav bashkirtsev
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
  • 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.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65335
97
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Naveen S", please check your private messages for an important administrative matter.
 
Vamsi Mohan
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, It is observer pattern. It observe calls from various sub-systems and receive data.
 
Chaminda Amarasinghe
Ranch Hand
Posts: 413
  • Mark post as helpful
  • send pies
  • 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
 
Hong Anderson
Ranch Hand
Posts: 1936
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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
 
Ronald Roest
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • 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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic