O'Reilly logo

Swift Functional Programming - Second Edition by Dr. Fatih Nayebi

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Strategy pattern

The strategy pattern is a behavioral pattern that lets an algorithm vary independently of the clients that use it. In other words, it allows one of a family of algorithms to be selected on-the-fly at runtime.

From an FP perspective, a strategy is just a case of abstracting code at a method level.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required