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 an asynchronous controller in asp.net mvc?
What are Scaffold templates in ASP.Net MVC?
What is meant by domain model?
Explain the advantages of asp.net mvc over asp.net?
Is entity framework slow?
What is oauth in web api?
What is the advantage of mvc?
What is code first? : Entity framework
What is orm entity framework?
What are non action methods in mvc?
what is split entity?
What is the mvc pattern (model view controller pattern)?
What are the levels at which filters can be applied in an asp.net mvc application?
Explain what is routing?
what is dot net? what is use dot net? what is benifit of dot net?what is vb dot net? what is ado dot net? what is c#?