ExampleFind
Example post, written to show this format.
Locality of Behaviour
An htmx essay about keeping the behavior of a piece of interface next to the markup it changes.
https://htmx.org/essays/locality-of-behaviour/Locality of Behaviour argues that the behavior of a unit of code should be obvious from looking at that unit. In the version htmx cares about, a button’s behavior lives in attributes on the button, not in a selector buried in another file.
I do not write htmx for the software I ship. The reason the essay stayed open is that the failure mode is everywhere else, too. A click handler three modules away from the control it changes is hard to trust, because reading the control tells you nothing. The same drift happens with CSS that only makes sense from a global stylesheet, and with a form whose validation lives in a hook named after last year’s refactor.
The useful test is small. If I am looking at the element, can I tell what it will do when someone uses it? If the answer is no, the behavior has moved too far away. I do not need to adopt the library to keep the question.