Skip to content

cristiangz14/head-first-design-patterns

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Head First Design Patterns

Strategy

The Strategy pattern defines a family of algorithms, encapsulates each one, and makes them interchangeable. Strategy lets the algorithms vary dependently from clients that use it.

Basically the Strategy patterns allow us to define a certain of behaviors for our class's members without depend on implementations instead using contracts (interfaces) and let the client decides what kind of implementation he prefers. It also allow the client change dynamically the behavior at run time.

Design principle commonly used:

Favor composition over inheritance. Encapsulate what varies. Program to interfaces, not implementations.

Check out the code example here

About

Code example and explanation from the First Head Design patterns book.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages