Strategy

xiaoxiao2021-03-06  50

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...

转载请注明原文地址:https://www.9cbs.com/read-116250.html

New Post(0)