jQuery in Action, 3rd edition
The moose likes Architect Certification (SCEA/OCMJEA) and the fly likes Whizlab's Q ?? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Architect Certification (SCEA/OCMJEA)
Bookmark "Whizlab Watch "Whizlab New topic

Whizlab's Q ??

Debanjana Dasgupta
Ranch Hand

Joined: Aug 11, 2000
Posts: 101
For this Q

You have invented the next generation spell checker that can learn from and automatically correct the common typing mistakes of an individual user. You have already sold licenses to many major software vendors and plan to retire in the sun. However, you are required to make slight changes in the logic to suit each software vendor's individual application needs. What design pattern will help you marginally change the logic in a class for use in different applications?
The answer is Template Pattern.
My question is why not Strategy?

Thanks<br /> <br />Debanjana<br /> <br />SCJP2<br />SCEA
Stephen Cowell

Joined: Feb 07, 2002
Posts: 22
I think your answer is better, but either one is correct. I wouldn't get hung up on that question, the exam is less ambiguous.
Debanjana Dasgupta
Ranch Hand

Joined: Aug 11, 2000
Posts: 101
Thanks for the reply.
I still do not understand where to use Template and when to use Strategy.
They seem to do similar stuff.
Shankar Ranganathan
Ranch Hand

Joined: Sep 19, 2001
Posts: 71
I think "Template" is the right one.The important part of this question is "slight changes in logic"
which says that there is a skeleton of the algorithm already and only a few changes to the logic needs to be made.This is ofcourse the template pattern.
Strategy pattern would be more applicable when there is a different set of algorithms and you can implement any one of them using the strategy pattern.
By the by how do you rate the whizlabs questions?


Shankar<br />Post mock questions in<br /><a href="http://groups.yahoo.com/group/scea_mock" target="_blank" rel="nofollow">http://groups.yahoo.com/group/scea_mock</a>
I agree. Here's the link: http://aspose.com/file-tools
subject: Whizlab's Q ??
It's not a secret anymore!