Live data from Hacker News

Htmx Is Composable?

timkellogg.me

11–20 of 69 posts

Re: Htmx Is Composable?

#11
post #4

This reminded me that one thing I miss from WPF is the "free" render-time polymorphism. If you had an interface, say ICard, and a few xaml data templates for how to render the concrete types, all you had to do was bind to a collection of ICards and it would automatically do what I guess we'd now call pattern matching on the concrete type of each element to render it without needing to mix the presentation with the pl…

Why did WPF go out of style? (or did it? idk) It seems like a good pattern, but it's always good to look at historical cases for the gotchas

Re: Htmx Is Composable?

#12
post #3

I'm not sure I fully understand the composable part. To me this seems like server-side rendered HTML on the one end (which indeed makes it easier to debug), and a react version on the other end. React would instead of passing the object directly to the renderer (as one can do when doing it all in one process), have some fetching mechanism. In terms of composability, react seems more composable to me. I can delegate t…

I think the key feature of htmx that often people overlook is that you can update several elements with one html response

The attribute is the following: https://htmx.org/attributes/hx-swap-oob/

Re: Htmx Is Composable?

#14
I am confused about htmx because if it is about AJAX, they don't replace the window URL as user clicks about and around unless you explicitly tell HTMX to do so.

And if you step into that realm of keeping the window URL in sync with where exactly the user is in the app, then you're almost already into realm of SPAs but without having the full set of tools that go with SPA.

Any open source project done in HTMX that has gone beyond TODO/LLM front ends etc could be interesting to look at

Re: Htmx Is Composable?

#15
post #3

I'm not sure I fully understand the composable part. To me this seems like server-side rendered HTML on the one end (which indeed makes it easier to debug), and a react version on the other end. React would instead of passing the object directly to the renderer (as one can do when doing it all in one process), have some fetching mechanism. In terms of composability, react seems more composable to me. I can delegate t…

I think the key feature of htmx that often people overlook is that you can update several elements with one html response The attribute is the following: https://htmx.org/attributes/hx-swap-oob/

that's even easier to do in react though. If I say, update the cart, and update my cart state in redux, then every component rendering the cart (say, header, checkout component, shipping progress bar) will update seamlessly.

To me htmx seems weird in its mixing of logic / API separation layer with the UI separation layer. I can see it making sense on single/small team projects and appreciate the lack of bundling and async communication and all the issues JS entails, but composability is not the argument that makes sense to me.

Re: Htmx Is Composable?

#16
> HTMX as Configuration

Bam, there you are, can't make programs with just configuration, that's a wet dream.

The article also mentions IoC configuration, which is a horrible way to program, another thing that is only good on paper.

Re: Htmx Is Composable?

#17
post #14

I am confused about htmx because if it is about AJAX, they don't replace the window URL as user clicks about and around unless you explicitly tell HTMX to do so. And if you step into that realm of keeping the window URL in sync with where exactly the user is in the app, then you're almost already into realm of SPAs but without having the full set of tools that go with SPA. Any open source project done in HTMX that ha…

not everything needs the window url to be updated.

* Add a comment on the timeline and you don't need the url to be updated. * Open a new record and the url needs to be pushed to history

Re: Htmx Is Composable?

#18
post #4

This reminded me that one thing I miss from WPF is the "free" render-time polymorphism. If you had an interface, say ICard, and a few xaml data templates for how to render the concrete types, all you had to do was bind to a collection of ICards and it would automatically do what I guess we'd now call pattern matching on the concrete type of each element to render it without needing to mix the presentation with the pl…

Why did WPF go out of style? (or did it? idk) It seems like a good pattern, but it's always good to look at historical cases for the gotchas

XAML is not a learn in a weekend type of deal and most dev don’t want to put the time to reading a proper book to learn it.

Re: Htmx Is Composable?

#19
post #3

I'm not sure I fully understand the composable part. To me this seems like server-side rendered HTML on the one end (which indeed makes it easier to debug), and a react version on the other end. React would instead of passing the object directly to the renderer (as one can do when doing it all in one process), have some fetching mechanism. In terms of composability, react seems more composable to me. I can delegate t…

I think many "clean" abstractions are about making a certain layer (horizontals) in a tech stack is clean, whereas functional parts in actual applications are most cleanly separated as functional verticals. But if you follow a clean vertical separation you will run into issues when horizontals (like common styling in a web-app or coherent network failures handling in many applications ) isn't handled cleanly.

For really clean applications you want your design to be a DAG, focusing on horizontals or verticals often leaves people with messes when you violate DAG constraints in the other direction.

What the author has issues with is that React frontend-monoliths would need extra machinery to work with separate compilation steps to allow separate building of verticals, with something like HTMX it's fairly loose (And separately worked on verticals can easily co-exist).

I think that this is part of the big divide between people who came from classic web-dev backgrounds and more latecomers from other domains (often manifested by the love or hate of DHH and his anti-TS/React stance).

Web-dev people would naturally land on writing verticals (one page = one task) and whilst their common abstractions could be horrible (SQL everywhere) they accomplished tasks well but cleaning up architectural messes could be bad.

Classic developers outside of web often saw applications, servers,etc (horizontals) as their main unit and made those clean, keeping the horizontal clean (like network failure handling) would influence design decisions (often at the expense of vertical concerns).

React allows for composability internally but often re-introduces issues on a larger scale, like your Redux store needs to know about parts from perhaps both user-admin and more application specific tasks. Now this is fine if it's a separately distributed application (like a mobile app) but people used to just handle one vertical at a time might feel that it's a lot of extra work other more contained cases.

Post reply on HN