How Did REST Come To Mean The Opposite of REST? | htmx (htmx.org)
from Kissaki@programming.dev to programming@programming.dev on 20 Nov 2024 12:29
https://programming.dev/post/21931459

#programming

threaded - newest

vzq@lemmy.world on 20 Nov 2024 12:57 next collapse

This is all very “old man yells at cloud”.

Interesting historical note, but things change.

Dunstabzugshaubitze@feddit.org on 20 Nov 2024 13:10 next collapse

I’d Agree in most cases, but not in this one.

Rigor in definitions allows us to express a lot of complex things in a compact form. this allows us to treat “Cars” as something different than “Motorcycles” while both a motorized vehicles.

the same is true for REST-API and other API-Types, while all of them are just a means to allow services to exchange data, they tell us a lot about how this exchange happens and what to expect, but only if we use the words in a way that they represent the concept they were meant to represent. Otherwise we end up with meaningless buzz words like “rest”, “agile”, “scrum”, “artificial intelligence” and so forth, instead of meaningful terms found in the jargon of other engineering disciplines like “magnetism”, “gravity” or “motor”.

frezik@midwest.social on 20 Nov 2024 13:49 next collapse

We’re well past that. I would probably care more if the original idea behind REST solved a real problem, but it doesn’t. It’s architecture astronaut stuff.

If REST is just about using HTTP verbs and status codes smarter, and sending the payload in JSON, I’m good to leave it at that. It’s useful.

vzq@lemmy.world on 20 Nov 2024 13:59 collapse

Besides, the original definition is not reflective of real world needs - which is why it’s morphed to something else.

sushibowl@feddit.nl on 20 Nov 2024 14:09 collapse

Rigor in definitions allows us to express a lot of complex things in a compact form. this allows us to treat “Cars” as something different than “Motorcycles” while both a motorized vehicles.

Meh. There’s plenty of room in the gray zone between “car” and “motorcycle” where things like this or this can exist. The botanical world has worked very hard to create rigorous definitions of fruits and vegetables only to be completely ignored by cooks. The culinary world in general has done just fine for centuries without rigorously specifying whether taco’s are sandwiches and cereal is a soup.

As long as it is generally understood what people mean by a word when they use it everything will be mostly fine. REST is an understood term, whether the inventor of the term meant something else by it is immaterial.

Dunstabzugshaubitze@feddit.org on 20 Nov 2024 14:35 collapse

my problem is not with words changing there meaning its with words losing meaning.

rest api today means any api ontop of http where response bodies are json, but nothing more, we can’t get much more general when talking about web apis than that, “rest” is almost meaningless and we don’t have a new word describing APIs that adhere to the constraints of what restful meant, but those are a useful tool for building web applications that can easily be used by a web browser. no matter if you like fielding-rest-style-apis or not, you lost the ability to call them by a name and gained murky mumbo jumbo for it.

MagicShel@lemmy.zip on 20 Nov 2024 14:47 collapse

I’m my observation, as a nearly-30-year-vet in the field, it’s due to the same factors as always. The technology doesn’t enforce the standard. So people do any fucking thing they want because they honestly don’t know any better.

I’m working on an app right now. On one of the controllers there is a single endpoint, out of about 30 (which should fucking tell you something right there) that conforms to restful standards. Every single other one of them is wrong. Because folks didn’t know better and leaders didn’t lead/teach/know any better themselves.

Slotos@feddit.nl on 20 Nov 2024 13:42 collapse

A cargo cult doesn’t change airplanes by building mock runways - they rather miss the point entirely.

freagle@lemmygrad.ml on 20 Nov 2024 14:23 next collapse

Honestly this is completely ridiculous. Hypertext using HTML constraints is absolutely insufficient for representing application state. It’s the wrong tool for the job and always has been, because it conflates document structure with semantic meaning.

Said another way, HTML cannot be relied on to capture a representation of application state.

The reason REST doesn’t use HTML in most contexts is because applications don’t use HTML in most contexts anymore.

Demanding that application representation use a specific encoding strategy is ridiculous and misses the point entirely, which is that HTTP is no longer the right protocol for the job.

Slotos@feddit.nl on 20 Nov 2024 15:12 next collapse

While HTML is hypertext markup language, hypertext is not HTML.

Hypertext doesn’t imply a specific encoding strategy, it implies semantics - data contains links to related data. If you want to encode it in protobufs - you do you, REST explicitly calls for freedom in this regard.

To paraphrase yourself, ranting about HTML as if it was a requirement for REST is ridiculous and misses the point entirely.

PS: HTML is not a protocol.

tyler@programming.dev on 23 Nov 2024 19:09 collapse

Yeah which you can do with JSON as well. GitHub’s API does exactly that, providing links to all the rest of the resources so the client doesn’t need to “know anything”.

The author of the article completely conflates JSON with “JSON == Not-REST” which couldn’t be further from the truth (also calling json apis “RPC” is fucking hilarious to me. I can tell the author has never touched actual RPC). JSON was standardized on because it encoded the information that was in html in a much smaller format and allowed a backend server to communicate with any client, not just a browser (not that other clients can’t use html or xml, but they didn’t want to because they might not be documents). Dealing with xml is a nightmare. JSON made that better, and still allowed you to do HATEOS if you really wanted to.

Kissaki@programming.dev on 20 Nov 2024 23:00 collapse

They’re not demanding anything. They’re describing how the current meaning of REST is nothing like the original one.

They’re making a point for not splitting application state and logic into client and server with shared knowledge. If you’re making that a pretext of course their argumentation won’t fit. They’re describing an alternative architecture and approach. Not an alternative protocol for the current common web application architectures.

HubertManne@moist.catsweat.com on 20 Nov 2024 15:09 collapse

This is sorta funny for me because as a non cs major who went into it it seems like all the api's I work with are called rest apis and I was always wondering what a non rest api would be.

macroplastic@sh.itjust.works on 20 Nov 2024 17:49 collapse

SOAP, which is basically dead, or GraphQL.

wizardbeard@lemmy.dbzer0.com on 20 Nov 2024 18:28 next collapse

Hahaha, don’t underestimate jank ass vendor systems. My workplace has at least one business critical thing using SOAP. We’ve been spinning our wheels on deprecating the damn thing for three years.

macroplastic@sh.itjust.works on 20 Nov 2024 22:28 next collapse

Lol, I probably should have said “legacy”. Would hope no one is writing new SOAP APIs in 2024!

rikudou@lemmings.world on 25 Nov 2024 19:25 collapse

Our government a few years ago made a cool new system to sniff on small businesses because they don’t have enough money to defend themselves properly in court track cash transactions and it was so hip and new that it used SOAP. That was the first* time I worked with SOAP, until then I managed to avoid it.

* I technically worked with SOAP once before but the part I worked on was like ten abstractions away from the protocol.

HubertManne@moist.catsweat.com on 20 Nov 2024 22:09 collapse

see. now I have seen references to soap but never really got that to. when it comes down to it my biggest concern is things just work.