Skip to content

LBeghini/Java-Design-Patterns

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

☕ Java Design Patterns

Strategy

Strategy pattern lets the implementation of the method vary independently for whoever uses it.

For example, let's say we have an app that calculates the shortest path depending of the means of transportation.

  • If you are going on foot, you want the shortest walking path.
  • If you are going by car, you want the shortest driving path.
  • If you are going by bicycle, you want the shortest cycling path.

The calculation algorithms of each method may vary. On foot, it might be benefitial to search for paths that doesn't have many climbs. By car, traffic must be taken under consideration. By bicycle, the path must be calculated throught streets that have a bike lane.

So each one of these calculations would be a different strategy.

About

Simple project to implement Java design patterns to a Programming Language class

Topics

Resources

License

Stars

Watchers

Forks

Contributors

Languages