O'Reilly logo

Swift 3 Functional Programming 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 solutions 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 DDD principles. The following are the SOLID principles:

  • The single responsibility principle ...

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