Function as Black Box

Programming Language

imperative or functional / any

Form

Analogy

Attribution — Origin / Source

Collected by Jan Pearce — Interview, Scott Heggen

Conceptual Advantage

Makes explicit that functions have inputs (parameters) and outputs (return value).

Mapping

PLNM
function black box
parameters arrow into the box
return value arrow out of the box

Draws Attention To

Parameter passing and return value.

Use When

First introducing functions.

Cost

not captured

Details

This notional machine also encourages a discussion of pure functions, for which the only way to communicate with the outside is to read their parameter values and to produce a return value.

Comments or Feedback?

Do you have feedback on this notional machine? Did you find a mistake, or do you have a request for improvement? You can create an Issue on GitHub, where the description is hosted. This way we can see your feedback and address it.

For this, you need a GitHub account. Then follow this link to see the source file of this page. In there, click the ... left of the highlighted line, then pick "Reference in a new issue".

Create an Issue on GitHub