Swift 3 Functional Programming
暫譯: Swift 3 函數式程式設計

Dr. Fatih Nayebi

  • 出版商: Packt Publishing
  • 出版日期: 2016-06-30
  • 售價: $1,880
  • 貴賓價: 9.5$1,786
  • 語言: 英文
  • 頁數: 296
  • 裝訂: Paperback
  • ISBN: 1785883887
  • ISBN-13: 9781785883880
  • 相關分類: Apple Developer
  • 海外代購書籍(需單獨結帳)

商品描述

Bring the power of Swift functional programming to iOS, OS X and Web development to build clean, smart and reliable applications

About This Book

  • Written for Swift 3, this is a comprehensive guide that introduces iOS and OS X developers to the all-new world of functional programming that has so far been alien to them
  • Learn about first-class functions and how imperative-style patterns can be converted into functional code using some simple techniques
  • The book will get you familiar with using functional programming alongside existing OOP techniques so you can get the best of both worlds and develop clean, robust code

Who This Book Is For

The book is for iOS and OS X developers with basic knowledge of Swift programming. Prior knowledge of object-oriented programming is assumed.

What You Will Learn

  • First-class, higher-order, and pure functions
  • Closures and capturing values
  • Custom operators, recursion, and memoization
  • Value and reference types in Swift
  • Enumerations, algebraic data types, patterns, and pattern matching
  • Generics and associated type protocols
  • Higher-order functions such as map, flatMap filter, and reduce
  • Dealing with optionals, fmap, and apply for multiple functional mapping
  • Functional data structures such as Semigroup, Monoid, Binary Search Tree, Linked List, Stack, and Lazy List
  • Immutability, copy constructors, and lenses
  • Combining FP paradigms with OOP, FRP, and POP in your day-to-day development activities
  • Developing a backend application with Swift
  • Developing an iOS application with FP, OOP, FRP, and POP paradigms

In Detail

Functional programming is getting a lot of attention because it eases many of the difficulties faced in object-oriented programming (OOP) such as testability, maintainability, scalability, and concurrency. Swift has a lot of functional programming features that can be easily used, but most Objective-C and Swift programmers are not familiar with these tools.

This book aims at simplifying the functional programming paradigms and makes it easily usable for Swift programmers, by showing you how to use functional programming paradigms to solve many of your day-to-day development problems. Whether you are new to functional programming and Swift, or experienced, this book will strengthen the skills you need to design and develop high-quality, easily maintainable, scalable, extendable, and efficient applications for iOS, Web, macOS, tvOS, and WatchOS.

The book starts with functional programming concepts, the basics of Swift, and essential concepts such as functions, closures, optionals, enumerations, immutability, and generics in detail with coding examples.

Also, this book introduces more advanced topics such as function composition, functional data structures, monads, functors, applicative functors, memoization, lenses, algebraic data types, functional reactive programming (FRP), protocol-oriented programming (POP), and mixing object-oriented programming (OOP) with functional programming (FP) paradigms.

Finally, this book provides a working code example of a real-world frontend application developed with these techniques and its corresponding backend application developed with Swift.

商品描述(中文翻譯)

**將 Swift 函數式編程的力量帶入 iOS、OS X 和 Web 開發,以構建乾淨、智能和可靠的應用程式**

## 本書介紹

- 本書針對 Swift 3 撰寫,是一本全面的指南,向 iOS 和 OS X 開發者介紹全新的函數式編程世界,這對他們來說是全然陌生的。
- 了解一級函數以及如何使用一些簡單的技術將命令式風格的模式轉換為函數式代碼。
- 本書將幫助您熟悉如何將函數式編程與現有的物件導向編程技術結合使用,讓您能夠充分利用兩者的優勢,開發出乾淨且穩健的代碼。

## 本書適合誰

本書適合具有基本 Swift 編程知識的 iOS 和 OS X 開發者。假設讀者具備物件導向編程的先前知識。

## 您將學到什麼

- 一級、高階和純函數
- 閉包和捕獲值
- 自定義運算子、遞迴和備忘錄
- Swift 中的值類型和參考類型
- 列舉、代數數據類型、模式和模式匹配
- 泛型和關聯類型協定
- 高階函數,如 map、flatMap、filter 和 reduce
- 處理可選值、fmap 和 apply 以進行多重函數映射
- 函數式數據結構,如 Semigroup、Monoid、二元搜尋樹、鏈結串列、堆疊和懶惰串列
- 不可變性、複製建構子和透鏡
- 在日常開發活動中將 FP 範式與 OOP、FRP 和 POP 結合

## 詳細內容

函數式編程受到廣泛關注,因為它緩解了物件導向編程 (OOP) 中面臨的許多困難,例如可測試性、可維護性、可擴展性和併發性。Swift 擁有許多可以輕鬆使用的函數式編程特性,但大多數 Objective-C 和 Swift 程式設計師對這些工具並不熟悉。

本書旨在簡化函數式編程範式,並使其對 Swift 程式設計師易於使用,通過展示如何使用函數式編程範式來解決許多日常開發問題。無論您是函數式編程和 Swift 的新手,還是有經驗的開發者,本書都將加強您設計和開發高品質、易於維護、可擴展、可延伸和高效應用程式所需的技能,適用於 iOS、Web、macOS、tvOS 和 WatchOS。

本書從函數式編程概念、Swift 基礎以及函數、閉包、可選值、列舉、不變性和泛型等基本概念開始,並詳細提供代碼範例。

此外,本書還介紹了更高級的主題,如函數組合、函數式數據結構、單子、函子、應用函子、備忘錄、透鏡、代數數據類型、函數式反應式編程 (FRP)、協定導向編程 (POP),以及將物件導向編程 (OOP) 與函數式編程 (FP) 範式混合的方式。

最後,本書提供了一個使用這些技術開發的真實前端應用程式的工作代碼範例,以及相應的使用 Swift 開發的後端應用程式。

最後瀏覽商品 (19)