Swift 2 Design Patterns
暫譯: Swift 2 設計模式

Julien Lange

  • 出版商: Packt Publishing
  • 出版日期: 2015-10-30
  • 售價: $1,250
  • 貴賓價: 9.5$1,188
  • 語言: 英文
  • 頁數: 224
  • 裝訂: Paperback
  • ISBN: 1785887610
  • ISBN-13: 9781785887611
  • 相關分類: Apple DeveloperDesign Pattern
  • 海外代購書籍(需單獨結帳)

相關主題

商品描述

Build robust and scalable iOS and Mac OS X game applications

About This Book

  • Learn to use and implement the 23 Gang of Four design patterns using Swift 2
  • Design and architect your code for Swift application development
  • Understand the role, generic UML design, and participants in the class diagram of the pattern by implementing them in a step-by-step approach

Who This Book Is For

This book is intended for competent Swift developers who want to apply enduring design patterns with Swift to structure and scale their application code.

What You Will Learn

  • Choose the appropriate pattern depending on the problem to be solved
  • Understand the generic class diagram of each of the 23 GoF patterns and how each object participates in the pattern
  • Use Swift to implement these patterns even though the language doesn't provide all of the object-oriented programming concepts such as abstract class, interface, and so on
  • Architect your software to avoid the overuse of memory, time spent on calculations, or high network traffic
  • Find the best way to organize your code to make it more secure from the outside world
  • Prepare your code to make it more flexible when the consumer changes or the third-party component hidden code changes
  • Structure your code to change the algorithm to apply at runtime
  • Deliver Flyweight responsibility to your objects

In Detail

Swift is a multi-paradigm language. It has expressive features familiar to those used to work with modern functional languages, while also keeping the object-oriented features of Objective-C. It remains compatible with Apple's legacy codes and frameworks. A design pattern systematically names, motivates, and explains a general design that addresses a recurring design problem in object-oriented systems. It describes the problem, the solution, when to apply the solution, and its consequences. It also gives implementation hints and examples. Knowledge about design patterns is also one of the best ways to make you different compared to other low-level developers.

This book shows you how to use Swift 2 to learn about 23 Gang of Four (GoF) design patterns, and is organized into three categories. The book will present you the five creational patterns, followed by the seven structural patterns, and finishing with the 11 behavioral patterns as defined by the GoF. Each chapter will introduce the pattern by defining its role, which common problems the pattern should be used for, its generic UML representation, how each objects presented in the class diagram participate in the pattern, and what the role of each of these objects is. The book then presents you with a concrete case as an illustration that will be used to implement the pattern using Swift.

Style and approach

A step-by-step tutorial completed with screenshots and code highlights wherever necessary. Each chapter discusses one or more patterns with its definitions and a simple-to-follow illustration case using a playground or XCText project to implement it with Swift.

商品描述(中文翻譯)

**建立穩健且可擴展的 iOS 和 Mac OS X 遊戲應用程式**

## 本書介紹
- 學習使用 Swift 2 實作 23 種 Gang of Four 設計模式
- 為 Swift 應用程式開發設計和架構您的程式碼
- 透過逐步實作來理解模式的角色、通用 UML 設計及類別圖中的參與者

## 本書適合誰
本書適合有能力的 Swift 開發者,想要應用持久的設計模式來結構化和擴展他們的應用程式程式碼。

## 您將學到什麼
- 根據要解決的問題選擇適當的模式
- 理解 23 種 GoF 模式的通用類別圖,以及每個物件在模式中的參與方式
- 使用 Swift 實作這些模式,即使該語言不提供所有物件導向程式設計概念,如抽象類別、介面等
- 架構您的軟體以避免過度使用記憶體、計算所花費的時間或高網路流量
- 找到最佳的方式來組織您的程式碼,使其更安全,免受外部世界的影響
- 準備您的程式碼,使其在消費者變更或第三方元件隱藏程式碼變更時更具彈性
- 結構化您的程式碼,以便在執行時改變應用的演算法
- 將 Flyweight 責任交給您的物件

## 詳細內容
Swift 是一種多範式語言。它具有對於習慣使用現代函數式語言的人來說熟悉的表達特性,同時保留了 Objective-C 的物件導向特性。它仍然與 Apple 的舊有程式碼和框架相容。設計模式系統性地命名、激勵並解釋一種通用設計,旨在解決物件導向系統中的重複設計問題。它描述了問題、解決方案、何時應用解決方案及其後果,並提供實作提示和範例。了解設計模式也是使您與其他低階開發者區別開來的最佳方式之一。

本書展示了如何使用 Swift 2 來學習 23 種 Gang of Four (GoF) 設計模式,並分為三個類別。書中將介紹五種創建模式,接著是七種結構模式,最後是 GoF 定義的 11 種行為模式。每一章將通過定義其角色、該模式應用於哪些常見問題、其通用 UML 表示、類別圖中每個物件如何參與該模式以及這些物件的角色來介紹該模式。然後,書中將提供一個具體案例作為示範,將用於使用 Swift 實作該模式。

## 風格與方法
逐步教程,必要時附有截圖和程式碼重點。每一章討論一種或多種模式,並使用 playground 或 XCText 專案進行簡單易懂的示範案例來實作。