Nguyen Le PhongNguyen Le Phong

Programming Beacons

Beacons are the small clues in code that trigger a usually-correct assumption about what is going on — a variable named 'node' tells you it lives in a tree or graph before you trace a thing. Good code is full of these quiet signposts, and you can deliberately enrich yours with them.

Beacons are the small clues in code that trigger an assumption about what is going on — an assumption that, most of the time, turns out to be right. Because they let your brain skip ahead with reasonable confidence, they save real mental expense: instead of reading every line to reconstruct meaning, you recognize a familiar signal and move on.

A beacon is often just a common naming convention. If a variable is named node, the odds are good it is an element of a tree, a graph, or some other connected structure. You didn’t trace its origin to form that expectation; the name did the work. Good code is full of these quiet signposts, and reading it feels fast precisely because the beacons keep confirming what you already guessed.

You can deliberately enrich your code by scattering beacons through it. And when the right cue is hard to embed in the statements themselves — when no name or structure can quite carry the hint — drop it into a comment instead, so the next reader inherits the same shortcut you would have wanted. (A small idea I keep returning to from a friend’s thinking.)

Though — does code still run on people?

What did you think?