Benefits:. • It provides a substitute to subclassing • It defines each behavior within its own class, eliminating the need for conditional statements • It makes it easier to extend and incorporate new behavior without changing the application..
Applicable Scenarios:. • Multiple classes differ only in their behaviors The servlet API is a classic example of this • You need different variations of an algorithm • An algorithm uses data that is unknown to the client...