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
How route table has been created in asp.net mvc?
What is razor code?
What is the use of razor view engine?
What is the difference between viewbag and viewdata in asp.net mvc?
What are sections?
What are html helpers in asp.net mvc?
Explain the types of Scaffoldings.
List out few different return types of a controller action method?
what is minimum requirement for entity framework applications to run?
Explain unit test done by tester on development team?
Explain the 'page lifecycle' of an ASP.NET MVC?
Can I add asp.net mvc testcases in visual studio express?
How to enable Attribute Routing?
What is the difference between viewbag and viewdata in mvc?
How we can register the Area in ASP.Net MVC?