liveBook · Manning

Protocol

A protocol is a language construct that declares operations or requirements implementable by types, often enabling polymorphic dispatch.

How 2 Manning books explain it

Classic Computer Science Problems in Swift: Essential techniques for practicing programmers

A Swift language construct that specifies requirements for types to adopt without defining a class hierarchy.

How it is used
Uses protocols to design a flexible, protocol-first graph framework.
How deep it goes
Defines requirements, associated types, extensions, and adoption in a graph framework without developing broader protocol theory.
Examples
Demonstrates Edge, Graph, UnweightedEdge, UnweightedGraph, and a city adjacency-list graph.
What you can do after
Build flexible Swift graph types by defining protocol requirements and supplying concrete adopting types.

Read how Classic Computer Science Problems in Swift: Essential techniques for practicing programmers explains protocol →

Clojure: The Essential Reference

A Clojure protocol is a named set of method signatures that types can implement and that is represented by a corresponding Java interface.

How it is used
Frames protocols as an efficient alternative to cascading instance? checks and a type-oriented choice alongside multimethods.
How deep it goes
Explains generated interfaces, dispatch lookup, implementation strategies, extension timing, metadata, and basic performance differences.
Examples
Demonstrates protocol inspection, String extension, direct and later implementations, numeric formatting, and polymorphic tree traversal.
What you can do after
Build it from scratch with defprotocol, implement methods directly, extend existing types, and inspect supported extensions.

Read how Clojure: The Essential Reference explains protocol →

Related concepts

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.