4 ms·
I've already linked in another comment on this thread so I won't repeat it, but there's a book explaining why. I didn't know this prior to reading the book, but
by danielvaughn 3y ago
I've already linked in another comment on this thread so I won't repeat it, but there's a book explaining why. I didn't know this prior to reading the book, but the original intent of RESTful APIs were to use hypermedia as the engine of application state (HATEOAS). Terrible acronym, but a really interesting idea.
There's a lot to say about it, but the essential idea is that if you let the server control the state of the application via hypermedia requests/responses, you eliminate a lot of the complexity that is associated with client-side web apps.
- nsonha 3y ago[flagged]
- yoru-sulfur 3y agoI think that dismissing it out of hand as useless is unproductive. From my understanding Roy Fieldings dissertation was a description and formalization of the web as it has been built, not just prescriptive advice on software architecture. To say it's not useful is to ignore how humans browse the web.
- nsonha 3y agomy memory is hazy but aren't semantic web, ontology and all that HATEOAS stuff for bots instead of humans? Now that LLM is here, what use do they have?
- hobs 3y agoStructured data doesn't magically go away because you have better interpretation of unstructured data that doesn't blow goats; it's still orders of magnitude easier to manage, store, and retrieve structured data.
- nsonha 3y agothe web is not data, this is the fundamental thing that's problematic about that way of thinking. We already have structured data, it's called database
- yoru-sulfur 3y agoFunny enough I recently ran into a very relevant blog post: https://intercoolerjs.org/2016/05/08/hatoeas-is-for-humans.html https://intercoolerjs.org/2016/05/08/hatoeas-is-for-humans.h... HATEOAS is for humans I haven't really thoughy about REST in relation to all the recent ML advancements. REST (With HATEOAS) might actually be a good way to expose APIs to these agents since they now have some ability to "reason" about responses beyond a hardcoded set of handlers
- relativeadv 3y agoI read a good chunk of the Hypermedia book and much of the argument is an appeal to authority around the fact that "real" REST design uses HATEOAS and well because Roy Fielding said so in 2000. Yes, I get that duplicating state on the client and the server is a headache. But are people really doing that? You're just moving the state toward the client and keeping the backend much more thin. Are we going to ignore the past twenty or so years of CPU improvements? I'm not saying just yolo it and do loads of pointless expensive work on the client but 5G and modern phones should have some place in this calculus.
- danielvaughn 3y agoThe latter half of your comment seems to assume that the primary reason for hateoas would be performance. I'm sure many people would make that argument, and I do think it makes sense even today, but that's not really why I'm into it. I personally find consuming JSON APIs cumbersome and prone to errors. It seemed like a great idea when we first started doing it, but these days I'm keen to explore other options. I'm under no illusion that HTMX doesn't have it's own tradeoffs, but I like the return-to-tradition approach it's taking.
- relativeadv 3y agoI can definitely get on board with that idea. It is indeed cumbersome dealing with some JSON api that you may or may not have written. The amount of boilerplate you must write in react just to fetch the freaking thing and do some work an display a result is rough compared to the same thing in django-htmx. But we are talking mostly about developer-experience here and while that is great, it is a compromise compared to user experience. Getting a little delay for an ajax call on much many more interactions is a thing and its there. Maybe that makes sense for many but it should be noted just like deciding to write a react PWA instead of a fully native ios app is a tradeoff for developer experience (or a dozen other reasons) instead of user experience.
- wild_egg 3y ago> Getting a little delay for an ajax call on much many more interactions is a thing and its there. HTMX has a preload extension which has fully eliminated these delays in my experience. YMMV of course but so far both my UX and DX are dramatically improved over what the previous SPA offered
- badbotty 3y agoAre you against using something like json-ld, hal,... for embedding links? Adding arbitrary hx- attributes to html which require a javascript application to make use of comes across as un-RESTful as doing so in json to me. Not saying you have to prefer it, but some of the htmx articles imply there is a difference.