What is Strategy pattern in OOP?

What is Strategy pattern in OOP?

In computer programming, the strategy pattern (also known as the policy pattern) is a behavioral software design pattern that enables selecting an algorithm at runtime. Instead of implementing a single algorithm directly, code receives run-time instructions as to which in a family of algorithms to use.

Why is it called Strategy pattern?

The idea behind the strategy pattern is that “algorithms can be selected at runtime.” (Wikipedia, Strategy Pattern) The pattern, in essence, is selecting the right strategy (or behavior) for solving a particular problem at runtime. Hence, it’s name.

Which is the best design principle in OOP?

4. Single Responsibility Principle (SRP) Single Responsibility Principle is another SOLID design principle, and represent “S” on the SOLID acronym. As per SRP, there should not be more than one reason for a class to change, or a class should always handle single functionality.

What are the principles of object oriented programming?

The Object-Oriented Design Principles are the core of OOP programming, but I have seen most of the Java programmers chasing design patterns like Singleton pattern, Decorator pattern, or Observer pattern, and not putting enough attention on learning Object-oriented analysis and design.

How many design patterns are there in Object Oriented Software?

To date, there are 24 design patterns, as described in the original book, Design Patterns: Elements of Reusable Object-Oriented Software. Each of these patterns provides a set of solution to a particular problem.

What are the disadvantages of Object Oriented Analysis and design?

Disadvantages of Object-Oriented Analysis and Design Ill-Suited to Procedural Applications: Given the object-oriented nature of OOAD, it is quite difficult (although not impossible) to practice OOAD techniques within a procedural programming language, or often to apply the techniques to non-object business logic.