Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Arrow up icon
GO TO TOP
Swift Functional Programming

You're reading from   Swift Functional Programming Ease the creation, testing, and maintenance of Swift codes

Arrow left icon
Product type Paperback
Published in Apr 2017
Publisher Packt
ISBN-13 9781787284500
Length 316 pages
Edition 2nd Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
 Nayebi Nayebi
Author Profile Icon Nayebi
Nayebi
Arrow right icon
View More author details
Toc

Table of Contents (19) Chapters Close

Title Page
Credits
About the Author
About the Reviewer
www.PacktPub.com
Customer Feedback
Dedication
Preface
1. Getting Started with Functional Programming in Swift FREE CHAPTER 2. Functions and Closures 3. Types and Type Casting 4. Enumerations and Pattern Matching 5. Generics and Associated Type Protocols 6. Map, Filter, and Reduce 7. Dealing with Optionals 8. Functional Data Structures 9. Importance of Immutability 10. Best of Both Worlds and Combining FP Paradigms with OOP 11. Case Study - Developing an iOS Application with FP and OOP Paradigms

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 Single Responsibility principle (SRP)
  • The Open/Closed principle (OCP)
  • The Liskov Substitution principle (LSP)
  • The Interface Segregation Principle (ISP)
  • The Dependency Inversion principle (DIP)

DDD principles are proposed to solve OOP problems. Also, FP addresses these...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime
Visually different images