Chapter    24

The Strategy Pattern

The strategy pattern is used to create classes whose functionality can be extended without being modified or subclassed, which can be useful when you are delivering frameworks to third-party developers or when any changes, however small, to key classes will trigger extensive and expensive testing and validation procedures. Table 24-1 puts the strategy pattern into context.

Table 24-1. Putting the Strategy Pattern into Context

Question

Answer

What is it?

The strategy pattern is used to create classes that can be extended without modification, through the application of algorithm objects that conform to a well-defined protocol.

What are the benefits?

The strategy pattern allows third-party developers to change the ...

Get Pro Design Patterns in Swift now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.