Skip to content

Protocol Discussion incorrectly associates Protocols with Abstract Classes #5

@quellish

Description

@quellish

In the section on protocols, the book states:
"A great miss in the Objective-C world is the outcome of the latest decades about abstract interfaces. The term interface is typically used to refer to the .h file of a class but it has also another meaning well known to Java programmers which is basically used to describe to a set of methods not backed by a concrete implementation. "

This is not accurate. In objective-c class clusters provide abstract interfaces (and are, usually, abstract factories). NSString, NSNumber, etc. are all abstract interfaces implemented as class clusters. Several framework classes allow specific class clusters to be extended at runtime (NSURLProtocol, etc.).

https://developer.apple.com/library/ios/documentation/general/conceptual/devpedia-cocoacore/ClassCluster.html

In contrast, a protocol only defines a set of messages that an object can choose to implement.

https://developer.apple.com/library/ios/documentation/general/conceptual/devpedia-cocoacore/Protocol.html#//apple_ref/doc/uid/TP40008195-CH45-SW1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions