4 ms·
We use it for a fairly chaotic internal CRUD tool together with Flask and Postgres. Basically there's stuff on my big computer, and it needs to get onto some o
by pjs_ 2y ago
We use it for a fairly chaotic internal CRUD tool together with Flask and Postgres.
Basically there's stuff on my big computer, and it needs to get onto some other guys' small computers. Sometimes the small computers need just a little bit of stuff from the big computer, or they want to tell the big computer something. If you put HTMX on the small computers, they can talk to the big computer and ask for bits of stuff whenever they want. And my nice big computer can do all the thinking, and I can tell it how to think, and the small computers aren't expected to think much, they just do what the guys say mostly.
This is great, and to me much better than the alternative which is that in addition to having to make the big computer think straight, I also have to install fucking npm on my own computer so that for every single feature I can write a turing-complete piece of thinking sludge which then goes onto hundreds of the other guys' small computers and tries to think for itself and breaks. Now I've got a big computer thinking, a hundred small computers thinking, and all these dumb guys thinking too. And I'm trying to think about what they all might be thinking and how that all interacts, fucking nightmare.
HTMX means that only the big computer is going to do any serious thinking, and the small computer only has HTMX, so it's too dumb to think. And so when I am thinking about the computers, I don't have to imagine what two computers might be thinking - only one.
Did you know that if you want to run a program in the terminal on your own computer, in order to make programs for other guys small computers, you should say "npx" not "node"? Even though they both execute code? If you don't know this innately, a priori, unfortunately you are the programmer equivalent of a stray dog or sewer-dwelling rodent. Oh and did you know that it's important to learn "type script"? Ah yes just what a language (or languages) made out of warm toffee needs, homotopy type theory. It will be so awesome when my IDE can render a little intellisense hint thing of the compound "List of List of Errors" type I just invented and finally I won't need to understand what the computer is thinking but can still commit a shit load of formally self-consistent code to prod. Statements dreamed up by the utterly deranged.
Anyway HTMX is very good in my opinion. One pjs_ Top Tip is that you can write less code if you make your server-side endpoints either return the full template or a partial component depending on the whether the HX-Request HTTP header is present or not - saves writing two different endpoints for the full page vs partials.
- lioeters 2y ago> turing-complete piece of thinking sludge Don't let the new-born AI sentience hear this, them's fighting words. But it does illustrate the kind of power that JavaScript gives. The language and especially its ecosystem is a jungle of abstractions and complications, hard to control and easy to break. That includes React and Next.js, speaking as someone who is still deep in that world. > put HTMX on the small computers, they can talk to the big computer and ask for bits of stuff whenever they want. And my nice big computer can do all the thinking That's a nice way to describe it. HTMX is re-thinking the problem space from the ground up, starting with HTML. That's a lot simpler to reason about, directly working with the user interface as it is rendered in the browser. How that HTML is dynamically generated is left up to the server, the actual "thinking" part. > "type script"? Ah yes just what a language..made out of warm toffee needs, homotopy type theory TypeScript is brilliant though, it's the best thing that could have happened to JavaScript. For what it had to work with as a starting point, it builds on that foundation a language that's more sane and reliable. With a type system that's at least better than before - implicit/invisible types or none at all. And the language server that enables intellisense, it's an ingenious way to empower the code editor - I use it heavily and can't imagine programming without it now. > make your server-side endpoints either return the full template or a partial component depending on the whether the HX-Request HTTP header is present Good to know! I'm still learning how to use HTMX, especially on the server side. It's a different way of thinking than an API with JSON.
- infogulch 2y ago> endpoints either return the full template or a partial component depending on the whether the HX-Request HTTP header is present This is great, just remember to add "Vary: HX-Request" header to your response else risk confusing the browser's cache.