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

OOP design principles

In this section, we will look at some of the problems with the OOP approach, and OOP and FP solutions to these problems.

In general, OOP is being criticized in the following manner:

  • Binding a data structure to behavior is a mechanism of state encapsulation that hides the underlying problem instead of solving it.
  • A great deal of effort goes into making inheritance possible. Ironically, object-orientated patterns themselves favor composition over inheritance. Ultimately, in handling two responsibilities--subtyping and reusing-inheritance is not good with either subtyping or reusing.

OOP solutions to these problems include SOLID and Domain-driven Design (DDD) principles. The following are the SOLID principles:

  • The

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