Locality of Behavior

📄 BetterWays.dev wiki page | 🕑 Last updated: Jan 21, 2022

undefined

"Locality of Behavior" (LoB) is a term coined by Carson Gross (author of htmx): https://htmx.org/essays/locality-of-behaviour/

Another way to describe it is "no spooky action at a distance" - try to be careful with introduction abstractions and the way you use them.

While it clashes with DRY (Don't Repeat Yourself), it doesn't mean you need to make everything local by copy&pasting the code everywhere.

A good example is a well-defined pure function - it should be very obvious just by looking at the calling site (by the function name and arguments) what the function is supposed to do, without doing "spooky" things at a distance.


Comments and suggestions

You can use this form to submit a suggestion or a comment.

If you find this site useful, please consider supporting it. Supporters also get access to some extras.