Structure and Interpretation of Computer Programmers

I make it easier and faster for you to write high-quality software.

Thursday, February 20, 2014

The Objective-C protocol naming trifecta

Objective-C protocol names throughout history seem to fall into three distinct conventions:

  • some are named after what a conforming object provides. Thus we have DBProperties, DBEntities, DBTypes and the like in Database Kit.
  • others are named after what the object is doing. Thus we have NSCoding, NSLocking, IXCursorPositioning etc.
  • still others are named after what the conforming object is. NSTableViewDataSource, NSDraggingInfo etc.

I think I prefer the second one. It emphasises the dynamic message-sending nature of the language: “because you’re sending messages from this protocol, I’ll act like this”.

posted by Graham at 09:38  

No Comments

No comments yet.

RSS feed for comments on this post.

Sorry, the comment form is closed at this time.

Powered by WordPress