.NET and Java J2ee Design pattern interview question :- What is the difference between Template and Strategy pattern?

 Posted by Questpond on 3/28/2011 | Category: .NET Framework Interview questions | Views: 4842 | Points: 40
Answer:

Below are the main differences between these two design patterns.

Template Design pattern
Defines outline for algorithms and allows sub class to override some steps.
Efficient in terms of less redundant code.
Depends on super class for methods.

Strategy Design pattern
Uses object composition to provide variety of algorithm implementation.
Flexible in terms of allowing users to change algorithm at run time.
All the algorithms can be itself implemented.

Regards,
Do visit our .NET design pattern and Java J2EE design pattern interview questions.


Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response