cocoa design pattern

 object composition (Decorator pattern) is often a better technique than subclassing for extending class behavior.

1.Abstract Factory

provides an interface for creating families of related or dependent objects without specifying their concrete classes

提供接口创建相同或类似的对象,不需要指定其具体的类型

iso中主要体现在NSNumber和NSArray和NSString以及NSDcitionary上

https://developer.apple.com/library/ios/#documentation/Cocoa/Conceptual/CocoaFundamentals/CocoaDesignPatterns/CocoaDesignPatterns.html#//apple_ref/doc/uid/TP40002974-CH6-SW6

2.Adapter

The Adapter design pattern converts the interface of a class into another interface that clients expect

将一个类的接口准确转换成clinet期望的一个接口,主要使用协议

3.Chain of Responsibility

The Chain of Responsibility design pattern decouples the sender of a request from its receiver by giving more than one object a chance to handle the request.

责任链主要将请求的发送者和接收者解耦

ios中主要体现在响应者链上

An instance of the NSInvocation class encapsulates an Objective-C message

4.Command

The Command design pattern encapsulates a request as an object, thereby letting you parameterize clients with different requests, queue or log requests, and support undoable operations

命令设计模式封装了对象要求从而的参数适应client不同的要求,排队或记录请求日志支持撤消操作

ios上主要体现在NSInvocation上面

 

 

 

posted @ 2012-08-16 22:16  Kalou  阅读(304)  评论(0编辑  收藏  举报