Skip to content

Implementation of design patterns in differents programming languages: Scala, Ruby, Java, JS, Python, PHP, Erlang and Go

Notifications You must be signed in to change notification settings

alanepontes/design_patterns

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 

Repository files navigation

##Design Pattern

  • Whats is?

"Each pattern describes a problem which occurs over and over again in our environment, and then describes the core of the solution to that problem, in such a way that you can use this solution a million times over, without ever doing it the same way twice" - Christopher Alexander says

###Strategy

Define a family of algorithms, encapsulate each one, and make them interchangeable. Strategy lets the algorithm vary independently from clients that use it. - Gof

###When to use the Strategy?

  • When you want to define a class that will have one behavior that is similar to other behaviors in a list:

    • Not flying
    • Flying fasts
    • Flying with rocket
  • When you need to use one of severel behaviors dynamically

  • Often reduces long lists of conditonals

  • Avoid duplicate code

  • Keeps class changes from forcing other class changes

  • Can hide complicated

###Problem?

  • Increased number of Classes.

###UML sample.

PlantUML model

About

Implementation of design patterns in differents programming languages: Scala, Ruby, Java, JS, Python, PHP, Erlang and Go

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published