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

4. Template Method

In many cases, an algorithm or process consists of several steps that are needed by many applications and one or more steps that may be unique to each application. The Template Method pattern implements the common steps within a reusable class while still enabling application-specific customization.

The Template Method pattern is also called the “Hollywood Pattern” because of the Hollywood cliché, “Don’t call us; we’ll call you.” The Template Method pattern identifies one or more methods that will be called automatically as needed by existing code but should not be called directly by application code.

A Template Method is nothing more than a special case of a method that is expected to be overridden in subclasses. The –dealloc ...

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