Effective Objective-C 2.0: 52 Specific Ways to Improve Your iOS and OS X Programs [NOOK Book]

Overview

Write Truly Great iOS and OS X Code with Objective-C 2.0!

 

Effective Objective-C 2.0 will help you harness all of Objective-C’s expressive power to write OS X or iOS code that works superbly well in production environments. Using the concise, scenario-driven style pioneered in Scott Meyers’ best-selling Effective C++, Matt Galloway brings together 52 Objective-C best practices, tips, shortcuts, and realistic code examples that are ...

See more details below
Effective Objective-C 2.0: 52 Specific Ways to Improve Your iOS and OS X Programs

Available on NOOK devices and apps  
  • NOOK Devices
  • Samsung Galaxy Tab 4 NOOK 7.0
  • Samsung Galaxy Tab 4 NOOK 10.1
  • NOOK HD Tablet
  • NOOK HD+ Tablet
  • NOOK eReaders
  • NOOK Color
  • NOOK Tablet
  • Tablet/Phone
  • NOOK for Windows 8 Tablet
  • NOOK for iOS
  • NOOK for Android
  • NOOK Kids for iPad
  • PC/Mac
  • NOOK for Windows 8
  • NOOK for PC
  • NOOK for Mac

Want a NOOK? Explore Now

NOOK Book (eBook)
$19.99
BN.com price
(Save 44%)$35.99 List Price

Overview

Write Truly Great iOS and OS X Code with Objective-C 2.0!

 

Effective Objective-C 2.0 will help you harness all of Objective-C’s expressive power to write OS X or iOS code that works superbly well in production environments. Using the concise, scenario-driven style pioneered in Scott Meyers’ best-selling Effective C++, Matt Galloway brings together 52 Objective-C best practices, tips, shortcuts, and realistic code examples that are available nowhere else.

 

Through real-world examples, Galloway uncovers little-known Objective-C quirks, pitfalls, and intricacies that powerfully impact code behavior and performance. You’ll learn how to choose the most efficient and effective way to accomplish key tasks when multiple options exist, and how to write code that’s easier to understand, maintain, and improve. Galloway goes far beyond the core language, helping you integrate and leverage key Foundation framework classes and modern system libraries, such as Grand Central Dispatch.

 

Coverage includes

  • Optimizing interactions and relationships between Objective-C objects
  • Mastering interface and API design: writing classes that feel “right at home”
  • Using protocols and categories to write maintainable, bug-resistant code
  • Avoiding memory leaks that can still occur even with Automatic Reference Counting (ARC)
  • Writing modular, powerful code with Blocks and Grand Central Dispatch
  • Leveraging differences between Objective-C protocols and multiple inheritance in other languages
  • Improving code by more effectively using arrays, dictionaries, and sets
  • Uncovering surprising power in the Cocoa and Cocoa Touch frameworks
Read More Show Less

Product Details

  • ISBN-13: 9780133386943
  • Publisher: Pearson Education
  • Publication date: 5/31/2013
  • Series: Effective Software Development Series
  • Sold by: Barnes & Noble
  • Format: eBook
  • Edition number: 1
  • Pages: 320
  • File size: 40 MB
  • Note: This product may take a few minutes to download.

Meet the Author

Matt Galloway is a software engineer and programming enthusiast specializing in mobile app development. He studied engineering at the University of Cambridge, England, and graduated in 2007 specializing in electrical and information sciences. He owns a consultancy, Swipe Stack Ltd., and answers questions about Objective-C, iOS, and Mac programming on Stack Overflow (stackoverflow.com).
Read More Show Less

Table of Contents

Preface         xi

Acknowledgments         xv

About the Author         xvii

 

Chapter 1: Accustoming Yourself to Objective-C          1

Item 1: Familiarize Yourself with Objective-C’s Roots  1

Item 2: Minimize Importing Headers in Headers  4

Item 3: Prefer Literal Syntax over the Equivalent Methods  8

Item 4: Prefer Typed Constants to Preprocessor #define  12

Item 5: Use Enumerations for States, Options, and Status Codes  17

 

Chapter 2: Objects, Messaging, and the Runtime         25

Item 6: Understand Properties  25

Item 7: Access Instance Variables Primarily Directly When Accessing Them Internally  33

Item 8: Understand Object Equality  36

Item 9: Use the Class Cluster Pattern to Hide Implementation Detail  42

Item 10: Use Associated Objects to Attach Custom Data to Existing Classes  47

Item 11: Understand the Role of objc_msgSend  50

Item 12: Understand Message Forwarding  54

Item 13: Consider Method Swizzling to Debug Opaque Methods  62

Item 14: Understand What a Class Object Is  66

 

Chapter 3: Interface and API Design         73

Item 15: Use Prefix Names to Avoid Namespace Clashes  73

Item 16: Have a Designated Initializer  78

Item 17: Implement the description Method  84

Item 18: Prefer Immutable Objects  89

Item 19: Use Clear and Consistent Naming  95

Item 20: Prefix Private Method Names  102

Item 21: Understand the Objective-C Error Model  104

Item 22: Understand the NSCopying Protocol  109

 

Chapter 4: Protocols and Categories         115

Item 23: Use Delegate and Data Source Protocols for Interobject Communication  115

Item 24: Use Categories to Break Class Implementations into Manageable Segments  123

Item 25: Always Prefix Category Names on Third-Party Classes  127

Item 26: Avoid Properties in Categories  130

Item 27: Use the Class-Continuation Category to Hide Implementation Detail  133

Item 28: Use a Protocol to Provide Anonymous Objects  140

 

Chapter 5: Memory Management         145

Item 29: Understand Reference Counting  145

Item 30: Use ARC to Make Reference Counting Easier  153

Item 31: Release References and Clean Up Observation State Only in dealloc  162

Item 32: Beware of Memory Management with Exception-Safe Code  165

Item 33: Use Weak References to Avoid Retain Cycles  168

Item 34: Use Autorelease Pool Blocks to Reduce High-Memory Waterline  173

Item 35: Use Zombies to Help Debug Memory-Management Problems  177

Item 36: Avoid Using retainCount  183

 

Chapter 6: Blocks and Grand Central Dispatch          187

Item 37: Understand Blocks  188

Item 38: Create typedefs for Common Block Types  194

Item 39: Use Handler Blocks to Reduce Code Separation  197

Item 40: Avoid Retain Cycles Introduced by Blocks Referencing the Object Owning Them  203

Item 41: Prefer Dispatch Queues to Locks for Synchronization  208

Item 42: Prefer GCD to performSelector and Friends  213

Item 43: Know When to Use GCD and When to Use Operation Queues  217

Item 44: Use Dispatch Groups to Take Advantage of Platform Scaling  220

Item 45: Use dispatch_once for Thread-Safe Single-Time Code Execution  225

Item 46: Avoid dispatch_get_current_queue  226

 

Chapter 7: The System Frameworks         233

Item 47: Familiarize Yourself with the System Frameworks  233

Item 48: Prefer Block Enumeration to for Loops  236

Item 49: Use Toll-Free Bridging for Collections with Custom Memory-Management Semantics  243

Item 50: Use NSCache Instead of NSDictionary for Caches  248

Item 51: Keep initialize and load Implementations Lean  252

Item 52: Remember that NSTimer Retains Its Target  258

 

Index          265

 

Read More Show Less

Customer Reviews

Be the first to write a review
( 0 )
Rating Distribution

5 Star

(0)

4 Star

(0)

3 Star

(0)

2 Star

(0)

1 Star

(0)

Your Rating:

Your Name: Create a Pen Name or

Barnes & Noble.com Review Rules

Our reader reviews allow you to share your comments on titles you liked, or didn't, with others. By submitting an online review, you are representing to Barnes & Noble.com that all information contained in your review is original and accurate in all respects, and that the submission of such content by you and the posting of such content by Barnes & Noble.com does not and will not violate the rights of any third party. Please follow the rules below to help ensure that your review can be posted.

Reviews by Our Customers Under the Age of 13

We highly value and respect everyone's opinion concerning the titles we offer. However, we cannot allow persons under the age of 13 to have accounts at BN.com or to post customer reviews. Please see our Terms of Use for more details.

What to exclude from your review:

Please do not write about reviews, commentary, or information posted on the product page. If you see any errors in the information on the product page, please send us an email.

Reviews should not contain any of the following:

  • - HTML tags, profanity, obscenities, vulgarities, or comments that defame anyone
  • - Time-sensitive information such as tour dates, signings, lectures, etc.
  • - Single-word reviews. Other people will read your review to discover why you liked or didn't like the title. Be descriptive.
  • - Comments focusing on the author or that may ruin the ending for others
  • - Phone numbers, addresses, URLs
  • - Pricing and availability information or alternative ordering information
  • - Advertisements or commercial solicitation

Reminder:

  • - By submitting a review, you grant to Barnes & Noble.com and its sublicensees the royalty-free, perpetual, irrevocable right and license to use the review in accordance with the Barnes & Noble.com Terms of Use.
  • - Barnes & Noble.com reserves the right not to post any review -- particularly those that do not follow the terms and conditions of these Rules. Barnes & Noble.com also reserves the right to remove any review at any time without notice.
  • - See Terms of Use for other conditions and disclaimers.
Search for Products You'd Like to Recommend

Recommend other products that relate to your review. Just search for them below and share!

Create a Pen Name

Your Pen Name is your unique identity on BN.com. It will appear on the reviews you write and other website activities. Your Pen Name cannot be edited, changed or deleted once submitted.

 
Your Pen Name can be any combination of alphanumeric characters (plus - and _), and must be at least two characters long.

Continue Anonymously

    If you find inappropriate content, please report it to Barnes & Noble
    Why is this product inappropriate?
    Comments (optional)