O'Reilly logo

Cocoa Design Patterns by Donald A. Yacktman, Erik M. Buck

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

12. Copying

The Copying pattern is used to create new object instances by copying existing instances. The act of copying objects is not always as clear cut as you might expect. For example, if you copy an object that contains other objects, should the copy contain the exact same objects as the original, or should the copy contain copies of the objects in the original?

Copying serves as an alternative to the Two-Stage Creation pattern introduced in Chapter 3, “Two-Stage Creation,” and enables the Prototype pattern in Chapter 21, “Prototype.” Copying also plays a role in the Accessor pattern from Chapter 10, “Accessors.” At a higher level, user interface actions, like copy and paste or drag and drop, are often implemented by copying application ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required