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?
Makes me feel the answer is Adapter. But I am not sure. Let me know your thoughts.
I think it's Adapter. The question asks pattern of JMS, don't get confused.
SCJA 1.0, SCJP 1.4, SCWCD 1.4, SCBCD 1.3, SCJP 5.0, SCEA 5, SCBCD 5; OCUP - Fundamental, Intermediate and Advanced; IBM Certified Solution Designer - OOAD, vUML 2; SpringSource Certified Spring Professional
Naveen K Sinha
Joined: Mar 16, 2004
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.
Joined: May 17, 2006
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.
Recognise this question from the whizlabs SCEA 5 part I mock exams. Bridge pattern should be the correct answer.
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.