It's time to capitalize on your mastery of Cocoa with Pro Objective-C Design Patterns for iOS. You've developed apps that impressed and performed, and now you're ready to jump into development practices that will leave you with more effective, efficient, and professional level apps. This book is the element you need to make the jump from journeyman to master.
All too often, developers grind through building good apps on willpower and a vigorous focus on code development, leaving them unaware of and unable to benefit from the underlying structural and functional design patterns.
Pro Objective-C Design Patterns for iOS will teach you those design patterns that have always been present at some level in your code, but were never recognized, acknowledged, or fully utilized. Implementation of specific pattern approaches will prove their value to any developer working in the iOS application arena. You'll learn to master classic patterns like singleton, abstract factory, chain of responsibility, and observer. You'll also discover less well-known but useful patterns like memento, composite, command, and mediator.
What you'll learn
The basic concepts of various design patterns
How to apply design patterns to your code based on different scenarios
How design patterns can strengthen your apps
Who this book is for
Any professional or aspiring iOS developer will find productivity, efficiency, and effectiveness of software development enhanced by the methods and practice delivered by Pro Objective-C Design Patterns for iOS.
Table of Contents
- About the Author
- About the Technical Reviewer
I. Getting Your Feet Wet
1. Hello, Design Patterns!
- 1.1. What This Book Is
- 1.2. What You Need Before You Can Begin
- 1.3. What You Need to Know Before You Can Begin
- 1.4. Design Déjà-vu
- 1.5. The Origin of Design Patterns - Model, View, and Controller (MVC)
- 1.6. Issues That Can Affect Your Design
- 1.7. Objects and Classes Used in this Book
- 1.8. How the Patterns are Organized
- 1.9. Summary
2. A Case Study: Designing an App
- 2.1. Conceptualizing the Ideas
- 2.2. Designing the Look-and-Feel
2.3. Architectural Design
- 2.3.1. View Management
- 2.3.2. Scribble Representation
- 2.3.3. Representation of a Saved Scribble
- 2.3.4. User Operations
- 2.4. Reviewing the Patterns Used
- 2.5. Summary
- 1. Hello, Design Patterns!
II. Object Creation
- 3. Prototype
- 4. Factory Method
- 5. Abstract Factory
- 6. Builder
- 7.1. What Is the Singleton Pattern?
- 7.2. When Would You Use the Singleton Pattern?
- 7.3. Implementing a Singleton in Objective-C
- 7.4. Subclassing a Singleton
- 7.5. Thread Safety
- 7.6. Using Singletons in the Cocoa Touch Framework
- 7.7. Summary
III. Interface Adaptation
- 8.1. What Is the Adapter Pattern?
- 8.2. When Would You Use the Adapter Pattern?
- 8.3. So You Know Delegation
- 8.4. Implementing the Adapter Pattern with Objective-C Protocol
- 8.5. Implementing the Adapter Pattern with Objective-C Blocks in iOS 4
- 8.6. Summary
- 9. Bridge
- 10. Façade
- 8. Adapter
IV. Decoupling of Objects
- 11.1. What Is the Mediator Pattern?
- 11.2. When Would You Use the Mediator Pattern?
- 11.3. Managing View Transition in the TouchPainter App
- 11.4. Summary
- 12.1. What Is the Observer Pattern?
- 12.2. When Would You Use the Observer Pattern?
- 12.3. Using the Observer Pattern in Model-View-Controller
- 12.4. Using the Observer Pattern in the Cocoa Touch Framework
- 12.5. Updating Strokes on the CanvasView in TouchPainter
- 12.6. Summary
- 11. Mediator
V. Abstract Collection
- 13. Composite
- 14.1. What Is the Iterator Pattern?
- 14.2. When Would You Use the Iterator Pattern?
- 14.3. Using Iterators in the Cocoa Touch Framework
- 14.4. Enumerating Vertices of a Scribble
- 14.5. Summary
VI. Behavioral Extension
- 15. Visitor
- 16. Decorator
- 17. Chain of Responsibility
VII. Algorithm Encapsulation
18. Template Method
- 18.1. What Is the Template Method Pattern?
- 18.2. When Would You Use the Template Method?
- 18.3. Using the Template Method to Make a Sandwich
- 18.4. Ensuring That the Template Method Is Working
- 18.5. Adding an Extra Step to the Template Method
- 18.6. Using the Template Method in the Cocoa Touch Framework
- 18.7. Summary
- 19. Strategy
- 20.1. What Is the Command Pattern?
- 20.2. When Would You Use the Command Pattern?
- 20.3. Using the Command Pattern in the Cocoa Touch Framework
20.4. Implementing Undo/Redo in TouchPainter
- 20.4.1. Implementing Drawing/Undrawing with NSUndoManager
- 20.4.2. Home-Brewing Your Own Drawing/Undrawing Infrastructure
- 20.4.3. Allowing the User to Activate Undo/Redo
- 20.5. What Else Can a Command Do?
- 20.6. Summary
- 18. Template Method
VIII. Performance and Object Access
- 21.1. What Is the Flyweight Pattern?
- 21.2. When Would You Use the Flyweight Pattern?
- 21.3. Creating a Hundred-Flower Pool
- 21.4. Summary
- 22.1. What Is the Proxy Pattern?
- 22.2. When Would You Use the Proxy Pattern?
- 22.3. Lazy-Loading an Image with a Virtual Proxy
- 22.4. Using a Proxy Pattern in the Cocoa Touch Framework
- 22.5. Summary
- 21. Flyweight
IX. State Of Object
- 23.1. What's the Memento Pattern?
- 23.2. When Would You Use the Memento Pattern?
- 23.3. Using the Memento Pattern in TouchPainter
- 23.4. The Memento Pattern in the Cocoa Touch Framework
- 23.5. Summary
- 23. Memento
- Title: Pro Objective-C Design Patterns for iOS
- Release date: April 2011
- Publisher(s): Apress
- ISBN: 9781430233305