Peg card: functions

You lit up: the execution isle, the Invoker at her wormhole, and the statesman tipping an island over the edge

Remember

  1. A function ship stores code. The Invoker runs it, and everything below waits until an island comes back.
  2. Think return, not do: a good function hands back one value.
  3. Functions are values: you can store them, pass them in (callbacks) and return them.

Spot it in the blog app

Find the early return, the callback, and the function that returns something. Is any of them a pure function?

Where this fits

The Universal Pattern is, at its heart, a pattern of function ships with different jobs. Containers call controllers, controllers call helpers, and helpers return values. From now on, whenever you read a function, ask: which kind of ship is this?