Sunday, June 17, 2012

Strategy (Policy) Pattern



  1. Strategy Class can be an interface or an abstract class
  2. There are a set of classes which extend abstract class or implement interface
  3. Switching between these classes changes the behaviour of application
  4. Using a class which extends or implements strategy class with conditional logic,conditional logic represents the behaviour of  application
  5. This pattern helps add or remove specific behaviour to application without having recode or retest all part of application
  6. algorithms can be changed at runtime or design time


JAVA: Strategy Design Pattern
http://www.youtube.com/watch?v=x3saJPT4SaE&list=PL028D1E25AAF87B8E&index=2&feature=plpp_video


Introducing the Strategy Design Pattern
http://www.youtube.com/watch?v=9n3gF39-trE

Overview of the Strategy Design Pattern
http://www.youtube.com/watch?v=F1841_llRSw&feature=channel&list=UL

Coding the Strategy Design Pattern
http://www.youtube.com/watch?v=vYByr2u8gqk&feature=autoplay&list=ULF1841_llRSw&playnext=1


Executing the Strategy Design Pattern
http://www.youtube.com/watch?v=mmiWFcjMTLw&feature=autoplay&list=ULvYByr2u8gqk&playnext=2
verbs are objects now


The strategy pattern is a behavioral design pattern that allows you to decide which course of action a program should take, based on a specific context during runtime. You encapsulate two different algorithms inside two classes, and decide at runtime which strategy you want to go with.
http://net.tutsplus.com/articles/general/a-beginners-guide-to-design-patterns/

No comments:

Post a Comment