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 Debanjana
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
posted
0
Thanks for the reply. I still do not understand where to use Template and when to use Strategy. They seem to do similar stuff. Thanks Debanjana
Shankar Ranganathan
Ranch Hand
Joined: Sep 19, 2001
Posts: 71
posted
0
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?