Strategy Pattern
Created: 18 July 2012 Modified:Defines a family of algorithms, encapsulates each one, and makes them interchangeable. Strategy lets the algorithm vary independently from the clients that use it.
Head First Design Patterns
If we were to use this pattern to associate a Super Hero’s talents and powers to the hero themselves it might look like the diagram below.
Experience tells me I would store the powers in a persistence layer (database) and would need something more flexible. Such as a name attribute for talents and powers that would let me use one class each for talents and powers.
tags: design patterns