4 ms·
Locality of Behaviour: "The behaviour of a unit of code should be as obvious as possible by looking only at that unit of code" https://htmx.org/essays/localit
by jack_riminton 3y ago
Locality of Behaviour:
"The behaviour of a unit of code should be as obvious as possible by looking only at that unit of code"
https://htmx.org/essays/locality-of-behaviour/ https://htmx.org/essays/locality-of-behaviour/
Some people want "cleaner" and that's fine, I much prefer things to be "right there" as much as possible. Must be how my brain works
- klysm 3y agoUnfortunately it’s a little more complicated than locality of behavior because there is a trade off with duplication and consistency of behavior
- jack_riminton 3y agoWell sure, you can make anything as complicated as you want it to be
- timeon 3y agoAlso known as spaghetti code.
- jack_riminton 3y agoSpaghetti would imply tangled surely? Tailwind is verbose but it’s the opposite of tangled
- lenkite 3y agoThis - the burden of affixing and naming the hundreds of pieces of composite styling consisting of 30+ tailwind classes is fully moved to the poor guy who needs to read, grok and maintain the code that the original author was too lazy to care about.
- npteljes 3y agoSpaghetti-ness is orthogonal to locality. You can have a clean god object, or a tangled abstraction. In my experience, neither invites spaghetti-ness more than the other. With less abstract code, you have less abstract spaghetti, and with more abstract code, you have more abstract spaghetti. And you can do both cleanly as well.
- xigoi 3y agoCSS is not behavior, but styling. Styling should be independent of behavior.
- troupo 3y agoIt shouldn't, and it has never been independent of behavior. The original pipe dream of CSS is not the only separation of concerns that exists: https://twitter.com/simonswiss/status/1664736786671869952 https://twitter.com/simonswiss/status/1664736786671869952
- angra_mainyu 3y ago> It shouldn't Changing a theme shouldn't affect behavior (by default).
- troupo 3y agoCSS isn't (just) about theming, and hasn't been since forever.