Ray's playground

 
1 2 3 4 5 ··· 56 下一页

2012年5月18日

Memento(Chapter 23 of Pro Objective-C Design Patterns for iOS)

摘要: You’d think about using the pattern when all of the following applies: 􀀁 You need to save the object’s state as a snapshot or a portion of it,which can be restored later. 􀀁 You need to hide the interface with which obtaining the state wouldexpose the implantation details. 阅读全文

posted @ 2012-05-18 13:44 Ray Z 阅读(291) 评论(0) 推荐(0) 编辑

Proxy(Chapter 22 of Pro Objective-C Design Patterns for iOS)

摘要: You’d naturally think about using the pattern when 􀀁 You need a remote proxy that provides a local representative for anobject in a different address space or in the network. 􀀁 You need a virtual proxy to create heavy-weighted objects on demand.We will implement that kind of proxy in a code examp. 阅读全文

posted @ 2012-05-18 11:13 Ray Z 阅读(220) 评论(0) 推荐(0) 编辑

Flyweight(Chapter 21 of Pro Objective-C Design Patterns for iOS)

摘要: You’d naturally think about using it when all of the following are true: 􀀁 Your app uses a lot of objects. 􀀁 Keeping objects in memory can affect memory performance. 􀀁 Most of the object’s unique state (extrinsic state) can be externalizedand lightweight. 􀀁 Relatively few shared objects can rep. 阅读全文

posted @ 2012-05-18 11:03 Ray Z 阅读(254) 评论(0) 推荐(0) 编辑

2012年5月17日

Command(Chapter 20 of Pro Objective-C Design Patterns for iOS)

摘要: You’d naturally think about using the pattern when 􀀁 You want your application to support undo/redo. 􀀁 You want to parameterize an action as an object to perform operationsand replace callbacks with different command objects 􀀁 You want to specify, queue, and execute requests at different times. . 阅读全文

posted @ 2012-05-17 14:11 Ray Z 阅读(289) 评论(0) 推荐(0) 编辑

2012年5月14日

Strategy(Chapter 19 of Pro Objective-C Design Patterns for iOS)

摘要: A class uses multiple conditional statements in its operations to definemany behaviors. You can move related conditional branches into theirown strategy class. You need different variants of an algorithm. You need to avoid exposing complex and algorithm-specific datastructures to clients. 阅读全文

posted @ 2012-05-14 14:39 Ray Z 阅读(273) 评论(0) 推荐(0) 编辑

2012年5月10日

Template Method(Chapter 18 of Pro Objective-C Design Patterns for iOS)

摘要: Define the skeleton of an algorithm in an operation,deferring some steps to subclasses. Template Method lets subclasses redefine certain steps ofan algorithm without changing the algorithm's structure. 阅读全文

posted @ 2012-05-10 13:55 Ray Z 阅读(269) 评论(0) 推荐(1) 编辑

2012年5月8日

Chain of Responsibility(Chapter 17 of Pro Objective-C Design Patterns for iOS)

摘要: You’d naturally think about using the pattern when 􀀁 There is more than one object that may handle a request and thehandler is known only at runtime. 􀀁 You want to issue a request to a group of objects without specifying aparticular receiver that will handle the request explicitly. 阅读全文

posted @ 2012-05-08 14:35 Ray Z 阅读(235) 评论(0) 推荐(0) 编辑

2012年5月4日

Decorator(Chapter 16 of Pro Objective-C Design Patterns for iOS)

摘要: We have introduced the Decorator pattern with its concepts and different approaches toimplement it in Objective-C. A true subclass implementation uses a more structuredapproach to connect different decorators. A categories approach is simpler and morelightweight than its counterpart. It’s suitable . 阅读全文

posted @ 2012-05-04 09:32 Ray Z 阅读(292) 评论(0) 推荐(0) 编辑

2012年5月3日

Visitor(Chapter 15 of Pro Objective-C Design Patterns for iOS)

摘要: The Visitor pattern represents an operation to be performed on the elements of an objectstructure. Visitor lets you define a new operation without changing the classes of the elements onwhich it operates. 阅读全文

posted @ 2012-05-03 13:48 Ray Z 阅读(284) 评论(0) 推荐(0) 编辑

2012年5月2日

Iterator(Chapter 14 of Pro Objective-C Design Patterns for iOS)

摘要: Provide a way to access to the elements of an aggregate object sequentially withoutexposing its underlying representation. 阅读全文

posted @ 2012-05-02 16:10 Ray Z 阅读(231) 评论(0) 推荐(0) 编辑

1 2 3 4 5 ··· 56 下一页

导航