Answer Posted / encapsulation
(I) Can you explain strategy pattern?
Strategy pattern are algorithms inside a class which can be
interchanged depending on the class used. This pattern is
useful when you want to decide on runtime which algorithm
to be used.
Let's try to see an example of how strategy pattern works
practically. Let's take an example of a math's calculation
where we have strategies like add and substract.
Figure 'Strategy in action' shows the same in a pictorial
format. It takes two numbers and the depending on the
strategy it gives out results. So if it's an addition
strategy it will add the numbers, if it's a substraction
strategy it will give the substracted results. These
strategies are nothing but algorithms. Strategy pattern are
nothing but encapsulation of algorithms inside classes.
Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
what is datacontrols?
Possible ways to prevent xss attacks on mvc application?
What are Non Action methods in ASP.Net MVC?
What are the new enhancements done in default project template of asp.net mvc 4?
Explain the types of Scaffoldings.
What are the sub types of ActionResult?
What is session state management?
What is edm in entity framework?
What is the advantage of mvc?
What is Attribute Routing in ASP.Net MVC?
Explain something about model, view and controllers in asp.net mvc?
mention in what all scenarios entity framework can be applicable?
What is presentation framework?
Explain the new features added in version 4 of mvc (mvc4)?
In Server how to check whether model has error or not in ASP.Net MVC