15,000 Jobs Available in:
Java, ASP, C#, PHP, SQL, SAP, MySQL and many more.
- Class Quick -
The moose likes Architect Certification (SCEA/OCMJEA) and the fly likes Question on design pattern Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Professional Certification » Architect Certification (SCEA/OCMJEA)
Reply Bookmark "Question on design pattern" Watch "Question on design pattern" New topic
Author

Question on design pattern

Kumar Ala
Ranch Hand

Joined: Apr 30, 2009
Posts: 53
I have some basic doubt in the following question.
Source:ePratize Labs

You are working as a System Architect and would like to build a Next Gen. code review tool for Java EE applications.Your boss wants to release different code review tools editions,and therefore you want to make few changes in the logic to suit different editions.

select the design pattern that helps to make few logical changes in a class that can be used in many editions.

1)Strategy
2)Template
3) Factory
4) Bridge
Answer given is Template pattern.

I would think that strategy is also possible as question says that "few logical changes in a class that can be used in many editions." something like changing the algorithm will be suitable for this. Can someone explain why not strategy ..?


kumar
SCEA5 P1
deepak adlakha
Ranch Hand

Joined: Jul 27, 2001
Posts: 318
I re-read the question two/three times and here is the catch in this phrase

"you want to make few changes in the logic to suit different editions"

Few changes in logic to suit different editions. With Template pattern only changes which are required to suite that particular version can be done.

There are only two option which we can think of from the given options "Strategy or template". But by reading the question phrase above, i think template pattern wins over strategy Because all common code can be placed in the base and only minor/few changes can be done in the subclass for each version or some other requirement without touching the base class or core template.

From implementation point of view strategy is also possible, but then each algorithm needs to contain its whole logic. I think the catch word in question is "few". But yes it can be debated between these two patterns like where will be less/few changes.

This message was edited 1 time. Last update was at by deepak adlakha

Kumar Ala
Ranch Hand

Joined: Apr 30, 2009
Posts: 53
you might be right Deepak...thanks.
 
 
subject: Question on design pattern
 
developer file tools