Neil Madden on Nostr: Lots of discussion of #REST APIs tends to focus on things like hyperlinks ...
Lots of discussion of #REST APIs tends to focus on things like hyperlinks (“HATEOAS”), or uniform interface, which are interesting topics for sure. But when I first heard about REST it blew my mind for entirely different reasons that seem rarely if ever discussed these days.
Like most programmers of my generation (and still now) I was taught OO as the way to write software: Stateful objects that you send messages to and which update their own state (which they keep hidden/encapsulated). When I thought about a remote API then it was natural to keep this world model: stateful objects on the server that you send messages to to update. All that mattered then was finding a good syntax for those messages.
REST completely flipped this on its head. Rather than the client sending messages to the server to perform actions on stateful objects, you instead sent (a representation of) the entire state of the object to the client. The client then updated it to the desired state and sent (a representation of) the final state back to the server. REpresentational State Transfer. That’s literally what it means.
Over 20 years on, I still find this vision astoundingly radical.
Like most programmers of my generation (and still now) I was taught OO as the way to write software: Stateful objects that you send messages to and which update their own state (which they keep hidden/encapsulated). When I thought about a remote API then it was natural to keep this world model: stateful objects on the server that you send messages to to update. All that mattered then was finding a good syntax for those messages.
REST completely flipped this on its head. Rather than the client sending messages to the server to perform actions on stateful objects, you instead sent (a representation of) the entire state of the object to the client. The client then updated it to the desired state and sent (a representation of) the final state back to the server. REpresentational State Transfer. That’s literally what it means.
Over 20 years on, I still find this vision astoundingly radical.