Strategy pattern in java

Hi Friends,

today i want to share strategy pattern, of course this is very well known and mostly used pattern. and their is lots of use cases where we need to use strategic pattern.

#what is Strategy pattern?

The strategy pattern(also known as the policy pattern) is a software design pattern that enables an algorithm’s behavior to be selected at runtime. The strategy pattern. defines a family of algorithms, encapsulates each algorithm, and makes the algorithms interchangeable within that family. more

#When to use?

when we have multiple algorithm for a specific task and want to decides the actual implementation to be used at runtime


Suppose there is one software startup company and they have limited resource to done their work but all resource have multi-talented to do multiple roles,  like four resources (EmployeeA, EmployeeB, EmployeeC, EmployeeD) each one can able to done coding, testing,content writing etc. and any work can assign to anyone . its depend on availability.

Screen Shot 2015-10-22 at 3.10.43 AM

you can find example on Github link



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s