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

Intention-revealing interface

In imperative OOP code, intent leaks through side-effects and focuses on the how rather than the what. Always having to bind behavior to the data structure can also be problematic.

As FP is more declarative, function names and interfaces tend to be more focused on intent rather than the underlying mechanics. In addition, the interfaces of side-effect-free functions are by nature more revealing because behavior is made explicit through the return value. As a result, in addition to the purely linguistic benefit of naming with intent, intent is also encoded by the type system. This is not to say that expressing intent is effortless in FP--only that it is better supported by the FP paradigm.

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