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 the difference between adding routes, to a webforms application and to an mvc application?
Why to use Html.Partial in ASP.Net MVC?
I want ask from plz smaple example code for Biztalkk server
What are the 2 ways of adding constraints to a route?
What is the difference between viewbag and viewdata in asp.net mvc?
how can you tell ef to have a different table or column name than that defined for the class?
What is meant by tempdata in mvc?
Can you explain the page life cycle of mvc?
What are differences between entity framework and l2s? : Entity framework
How does the .net framework 3.0 relate to windows vista?
what is csdl?
What are non action methods in mvc?
Which version of .net framework is installed?
What is entitycontainer? : Entity framework
How to Redirect Tracing to a File