Re:Django, HTMX and Alpine.js: Modern websites, JavaScript o...
by lhorie on Tuesday November 23, 2021 @03:32PM
(#29323050)
I'm curious about your thoughts on that locality of behavior idea vs aspects of precision and composability. For example, the argument goes that the behavior of `hx-get` is obvious upon inspection, but the terseness is achieved by omitting the event type (i.e. it's assumed/implied that hx-get runs on click). The quintessential widget where that breaks down is the table w/ checkboxes for batch operations over an arbitrary subset of rows. That's where less DSL-ish frameworks' abstraction via state management tend to shine, since they allow the developer to more precisely specify how disparate checkboxes relate to a bigger picture that may also involve table sorting (both client and server varieties) or nested modal structures or other forms of complexity.
Re:Django, HTMX and Alpine.js: Modern websites, JavaScript o...
by EugeneOZ on Wednesday November 24, 2021 @01:54AM
(#29327550)
Button should not have any behavior, it should generate an event. Your app can have one or multiple listeners for this event. This pattern is battle-tested for decades.
Re:Django, HTMX and Alpine.js: Modern websites, JavaScript o...
by recursivedoubts on Thursday November 25, 2021 @11:20AM
(#29342563)
OK, but the response to that event should be localized to the button.
Re:Django, HTMX and Alpine.js: Modern websites, JavaScript o...
by JasonCannon on Wednesday November 24, 2021 @03:33AM
(#29328000)
Why? Have any reading on this?
Re:Django, HTMX and Alpine.js: Modern websites, JavaScript o...
by EugeneOZ on Wednesday November 24, 2021 @03:52AM
(#29328117)
Of course :) Have you tried to find something before asking?
https://en.m.wikipedia.org/wiki/Reactive_programming
https://developer.mozilla.org/en-US/docs/Web/API/EventTarget...
Re:Django, HTMX and Alpine.js: Modern websites, JavaScript o...
by JasonCannon on Wednesday November 24, 2021 @01:18PM
(#29333208)
1.) Don't be a jackass.
2.) I know what reactive programming is, I make extensive use of RxJS at work. And I obviously know what an event listener is. I was asking why is it wrong to have the button have functionality and only emit events. And I did google that, but nothing from your comment you posted that I googled lead to anything about reactive programming.
a bit focus of htmx, alpinejs (and htmx's sister project, https://hyperscript.org) is putting the logic on the element, so you can see exactly what a button, etc. does just by looking at it, and without trawling through ten files of indirection
i am trying to popularize the term Locality of Behavior to describe this design goal:
https://htmx.org/essays/locality-of-behaviour/