algorithms (22) Design Patterns (20) java (19) linux (14) Snippet (13) service mix (6) soa (4)



Strategy Pattern

  1. Defines a set of algorithms
  2. Makes them interchangeable
  3. clients have the option to select 
in the example below the client can tell the type of indexer to use in the dictionary
the behavior of indexer which changes is moved to another class there by separating
the class which changes and the one which does not change 
the dictionary delegates calls to search and sort to the indexer 

No comments:

Post a Comment

Search 24 Bytes