WILTAC #2: Designated initializers

I learned today the term designated initializer:

When a class has multiple initializers, the designated initializer is the one that actually does the work, normally the one with the most parameters. All other initializers call the designated one, providing different amounts of default parameter values.

I was aware of the concept – many classes have initializers with varying numbers of parameters, with the “simplest” ones setting things to default values, and the more complex ones allowing greater control. I didn’t know the term.

I found two other uses for the term designated initializer:

  • In the C99 language specification, you can selectively initialize elements in an aggregate data structure, this construct is called a designated initializer.
  • It’s the title of a song performed at WWDC 08 by James Dempsey and the Breakpoints (of course, related to the Objective-C definition).

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s