Working with Strategy in AS3/Flex
Strategy tells us to • Define and encapsulate a family of algorithms. • Make encapsulated algorithms interchangeable. • Allow algorithms to change independently from the clients that use it. HRAgency For illustration purposes,in this sample application, a Strategy pattern is used to implement a solution for an HR employment agency. • The agency has a number of consultants it represents. Clients call for different consultant job types targeted at either- employer or jobseeker. They want either a particular consultant or particular support tasks or main tasks they can perform. • To create a flexible program for the HR agency, each of the specific support related and main tasks has been created in separate algorithms. The algorithms are encapsulated, and the consultants delegate their performance skills to the encapsulated algorithms—strategies. The base Consultant context class The first step is to create a context class and concrete contexts that will use the different tasks and support...