Source: www.eloquentarchitecture.com

Locality of Behavior
The LoB principle dictates that the behavior of a unit of code should be as obvious as possible by looking only at that unit of code. The behaviour of a unit of code should be as obvious as possible by looking only at that unit of codeThe LoB principle is a simple prescriptive formulation of the quoted statement from https://www.dreamsongs.com. In as much as it is possible, and in balance with other concerns, developers should strive to make the behaviour of a code element obvious on inspection.

But, is simply placing these things next to each other enough to make a unit of code "obvious"?

You have to admit that this code satisfies the LoB principle pretty damn well.
Newsletter

Get the latest Laravel/PHP jobs, events and curated articles straight to your inbox, once a week

Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future. Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future.
Community Partners