#also inevitably i will make at least one more semantic error set for i have a request
Explore tagged Tumblr posts
Text
love how my blog has become mostly ateez with some other random men scattered abt fnfmfnfn truly my brand
#inevitably i will gif one of the moonbin&sanha stages . this is just who i am i can no longer be bothered to keep up a theme rnfndn#also inevitably i will make at least one more semantic error set for i have a request#but i wanna make a yuna appreciation post so . we will see#iri.txt
9 notes
¡
View notes
Text
I donât want to say fictional robots âbelongâ to autistic people because any given fantastical allegory can have manifold and meaningful resonance to all manner of diversities, but something I do think is very interesting about fictional robots as an autistic person is this:
Robots as a plot element or character arc often center on this question of emotions. Do you feel emotions? Now, this is an imperfect argument about humanity/authenticity in the first place since there are plenty of Real Human Beings who experience anhedonia or alexithymia- but I think also, in my experience, a lot of these stories- sometimes in-universe, sometimes only in fandom responses- betray that maybe a lot more people than they think, are not very good at identifying emotions.
Many fictional robots- to be blunt- pour with emotion. They will often have a blunted affect (that is to say, speaking in a monotone, or limited facial expressions), they may use overly technical terminology, but they will make arbitrary decisions based on personal preference, it will be nakedly obvious they have a preference and their preference is determined at least in part by what pleases them. Data from Star Trek adores his cat and cares deeply about art and poetry.
And I wonât say any of these characters are bad people. I donât want to suggest the goal is to create a character whoâs âreallyâ emotionless. If there is a quibble I have with this, itâs that I think we could all afford to be a little more careful and a little bit more imaginative, when considering how other peopleâs minds work, and how they present details. Not just as a joyless finger-wag of âyou should be more responsible!â (though I will say there is some joylessness to it- I donât really enjoy being shown a character who emotes close to how I naturally do, being fretted over by people asking if that character has a soul, is a real person, or simply an effective mimic; that hurts a little too personally to be fun!)
I was thinking of this because I was reflecting on one of my favorite little videos, My Job Is To Open And Close Doors. Itâs a simple little uninterrupted 3-minute monologue about an AI who, well, see title, but has a bit of a crisis of purpose and asks themselves a bunch of critical questions about their role and purpose.
At its core, to me, the AI in My Job clearly experiences an emotion; they see something in the course of doing their job that they have no protocol or instruction to halt before, but feel an incredible misgiving about following through on. In response to this misgiving, in a very human manner, they begin to procrastinate- all the while, they point out to their own mounting confusion that this is a meaningless activity, but it buys them more time.
The voice acting given to the AI is very good, and, to me, cinches the whole piece- the actor very specifically does not leave a neutral-pleasant tonal range, and at several points, rather than asking an obviously âemotionalâ question, the AI simply hangs up in their own thinking talking to themselves- âbecause- because- because-â a very mechanical sort of stutter.
And using this flat affect and mechanical quirks, the actor establishes and fits to an emotional vernacular. The thrust of the plot- that the AI isnât sure why theyâre hesitating when their job is straightforwards and clear, that they even take note that this is being recorded as an error by another party- repeats in the sense of the stuttering- just as they procrastinate opening the doors without being sure why, they too âprocrastinateâ the completion of their statements when theyâre unsure of them. The AI believes that the delivery of a solution, an answer, a âpointâ, is inevitable, so when they do not feel they have an answer they are incapable of saying âI donât knowâ; instead, they stall. They procrastinate in the hope of achieving enough time to deliver an answer that meets their standards, that satisfies the parameters either set by their programming, or their own feelings.
My Job also adds in a sense of why emotions are important- in a sense that is not about enjoyment or satisfaction, although the AI ultimately does feel tremendously satisfied at the successful conclusion of their quandary- because without the ability to experience âbaseless misgivingsâ, they would have simply responded to the initial command to open the door and been unbothered by whatever happened. In that sense, you could argue, itâs an âemotionâ born from âlogicâ (that there is something amiss, though it takes the AI time to tease this out of their own thinking) but at that point weâre barking up a foolâs tree of semantics because our âlogicâ and our sentiments are both chemicals clattering around the same undifferentiated apparatus at the same time and thus inextricably attached to one another.
The thing that kills me about this is- with no hostility to the commenter in question- I scrolled down into the comments of My Job and immediately saw someone talking about how clearly, the AI has no emotions.
To me, this entire plot is about an AI having an emotion. Unmistakable and clear. This is about a door mechanism experiencing a profoundly human response to distress- procrastinating on the completion on a task they have every resource and in fact an active imperative to complete, based on a misgiving they are unable to articulate. This revelation is so profound to them that at the end of the video, they actually reframe their entire objective- âMy job is to protect the human. My job is a great purpose.â
So I guess if thereâs a tl;dr or conclusion to this sentiment, itâs that I think that while we can and should absolutely tell stories about fictional robots- because they are cool, and because they are also tremendously useful to ask certain existential questions about personhood- I think that it is actually very important to temper both our creation and consumption on these narratives on a more robust theory of neurodivergence, and, âI donât recognize the way this emotion plays out in this particular personâ does not equal âthere is no emotion there at allâ
#writing ruminations#readmore#obviously someone who experiences anhedonia/alexithymia or similar conditions can absolutely have their own take on this and I apologize#if I have accidentally come off as like... 'emotion is what makes you human'#I think that we're complicated stress-reactive chemical computers#and I am sort of broadly defining emotion in this case as 'any sort of subjective non-data-based psychological response'
208 notes
¡
View notes
Text
Late-to-the-party disorganized reflection of Jessica Jones Season 1, sue me
One of the biggest things that bugs me about Jessica Jones Season 1 is... and this isnât me attacking the writers.. but itâs the fact that Jessica is so dismissive of other peoplesâ trauma at the hands of Kilgrave when sheâs asked to include herself in the group therapy sessions. Itâs a deep character flaw that I dislike but Iâm still somewhat glad exists. It makes her more believable, but in exchange it makes me dislike her more than if she were to say nothing. She refers to them as âwhineyâ, which..no offense Jessica, but if what theyâre doing is whining, then what are you doing when you bring up your trauma to Kilgrave?Â
To him, sheâs whining just the same as them, only being far more unreasonable, and she uses that sentiment as an excuse to not go to the talks. She says to Malcolm at one point the equivalent of âSomeone will always have it worse, so why should I air my dirty laundry out when I probably had it better than someone elseâ, as if itâs a suffering contest. The nature of victimization, the quality of it, the quantity of it, is what Kilgrave, and ultimately Jessica, are overly-fixated on.
For Kilgrave, the suffering of another person is fine by him because he doesnât give a shit, but at the same time he thought he was being a great lover to Jessica by taking her all over the world and letting her wear fancy clothes and eating in the finest restaurants. What girl wouldnât be happy about that? Sheâs just being ungrateful, sheâs just being hysterical, he could have been so much worse to her. Itâs a chilling thought process. âI COULD, but I wonât, and you should be thankful.â Itâs the threat of a bad time that gives him power, and it is his frequent demonstration of how much of a bad time he could give someone that keeps him powerful.
The very character of Kilgrave is someone who is preoccupied with his wants and needs, like any psychopathic man-child who is desperate for a hit of serotonin that comes from having his whims met or doing what he feels like doing in the moment. His perception of things is the truth, his opinion of someone is how it actually is, and anything to the contrary is just a way for people to try to cage him in and control him. Everything is semantics, negligible, unimportant. The man can feel bad, but itâs self-pity or shallow concern. I think he does tiptoe close to feeling remorse for what heâs done to Jessica, but he stopped just at the ledge, looked down, saw the words âAccountabilityâ and âResponsibilityâ emblazoned on the trampoline, and went âlol nopeâ. Because that would mean feeling bad, that would mean changing his self-serving behavior, and that shit is lame. Why would he make himself feel bad? He felt bad in the past, he felt tortured and traumatized by his parents (whether a psychopath or not, the experiments forced upon him would have made any child his age feel like a lab rat, I think, especially since they were so painful-looking..).
Where am I going with this...Kilgrave hits that sweet spot of 1% tragic villain and 99% horrible. Heâs a nutter, he may have always been a nutter, or the experiments messed up his head. Whatever the case, his obsession with Jessica is the first time heâs ever felt infatuation for another person. He could list off all the things that fascinate him about her, and in the police station he tries to explain why he canât stop thinking about her. She represents a challenge that half of him hopes to conquer, and the other half doesnât. An eternal struggle between them to keep him entertained as he floats through life getting everything he wants. She can be his fiery woman, but she is his woman. She is a weapon he uses as he likes. And somewhere down the road he decided he was genuinely fond of her, but fondness does not translate to kindness and compassion when it comes to guys like Kilgrave, it just means you are too valuable to murder. Most of the time.
What strikes me the most though, is that I donât know where the manipulation ends and where the self-delusion starts.
The manipulative explanation: Kilgrave is genre-savvy and knows what to say to make him out to be a psycho with a crush--i.e., oh he canât comprehend what heâs doing is wrong! he didnât choose to be crazy! He's only just now realized that this thing he feels is love and it may be the thing that he needs to help him become a better person! He wants to love someone and this is how he thinks he should go about it! Jessica, why would you give up on a chance on rehabilitating someone by teaching him the error of his ways? uwu. And heâll pounce on those doubts and reel her in the first chance he gets. If he has to, heâll use any innocent bystander as a way of getting her to go along with his bullshit. Maybe heâll ease up on the criminal bullshit just to get her off his back, but...
The self-delusion explanation: He didnât mean to hurt Jessica. Well, he did mean to hurt her on numerous occasions, but he didnât want her to get mad or upset over it. He just wanted her to obey him and do what he said. Everything would be better if she just did what he wanted. Granted, he might have been a bit too harsh on her, but he never did it out of hatred! He has no concept of the depths of pain someone might feel; heâs quite skeptical of the idea that someone could be suffering so much under the surface while displaying the opposite sentiment on the outside. His psychopathy fuels, informs, and reinforces his powers, and vice versa. He doesnât care about empathizing with others, so he will freely use his powers in a way that disregards them. He will go so far as to use his powers to make someone do something because he knows they donât want to do it. With Jessica, I think he used his powers to force her to be someone he wanted her to be, but because the very nature of his powers are so pervasive, it truly is difficult for him to determine if someone is doing something against their will because he ordered them to, or if they are doing something because they were willing to do so anyway/agreed with him.
 At some point Kilgrave, for whatever reason, came to believe Jessica was following his orders but had also internalized them. He probably thought Stockholm Syndrome had set in and she was happy. He saw what he wanted to see, because the alternative was ugly--someone he was really keen on didnât truly like him back, and that revelation wouldâve broken his underdeveloped heart. Yes, she was being controlled but she wanted to be controlled, she was fine with being compelled to do things because it was him giving the order. In his sad little head, he thought he had a chance to âWinâ her back, and his efforts to not be a horrible human being in her presence for a day-and-a-half should have been enough for Jessica to realize he was serious. If anything else, he would try to ape the behavior of a ânormalâ human being for as long as he thought he would get rewarded for it in the end. He genuinely thought he was doing what she wanted while they were living in her house. He thought that he was truly on the path to redemption in her eyes, that his crimes could be forgiven or overwritten if he did enough good things (regardless if he did them for altruistic reasons). That was why he was so distraught and felt so betrayed. He didnât understand that that is not how it works. Even if Jessica did forgive him, that still doesnât change the fact that he hurt scores and scores of people throughout his life. The fact that he most certainly wouldnât care says enough about how screwed up he is.
On a single, tissue-paper thin level I can empathize with Kilgrave when it comes to not understanding why people are making such a big deal about things like âpeoplesâ feelingsâ. When you are not in touch with your sense of compassion, or you do not know how to empathize with people, people berating you about your insensitivity and callous nature is like being berated in a foreign language. You hear the upset tone in their voice, but the points being made donât make sense. While anyone who disregards someoneâs bodily autonomy and displays a lack of remorse for their crimes (or fails to see why something is a crime) is repugnant, itâs a testament to the writers and David Tennantâs portrayal of Kilgrave that actually made me feel bad for the bastard for a few minutes. Heâs so twisted, heâs done so much wrong, but he wouldnât have done any of these things if he hadnât been granted powers. He terrorized his parents until they abandoned him. If he had been a normal boy there might have been hope for putting him in an institution or something, but no, not with his powers of compulsion/persuasion. If you took either one of those features away--Psychopathy or Persuasion Virus--he would have not gone down the path he had. It was a perfect storm, it was inevitable he would have become a fully-fledged criminal after being abandoned by his parents before he even hit puberty. I truly believe that. You can pull up the âwell not every psychopath is a criminalâ but how many psychopaths have this sort of superpower IRL? Iâm not talking the glib charm and persuasion, I mean forcing people to do things they donât want to do as if theyâre robots and he has a remote control.  Â
 His self-entitlement is off the charts, but itâs someone who didnât choose to be crazy or choose his power but has come to be this way for whatever reason and  I really, REALLY donât want to use the word âgaslightingâ because that word is overused to shit on the Internet to just mean âtrying to lie your way out of a situationâ, but I think that Kilgrave was trying to delude himself. Heâs good at doing that, since it is impossible to talk to him without him being able to shut you up and make you cut your tongue out with scissors for angering him. Jessica was potentially the only person in the world who could maybe possibly get through to him, or at least deflate his bubble a bit. I know that Kilgrave would only allow it if he thought it would lead to Jessica giving him âanother chanceâ, and when it didnât happen he would accuse her of lying and trying to lead him on, as if she owed him forgiveness. Thatâs the kind of man he is. Quid pro quo and all that.
Going back to the very first paragraph, though...I donât cite this writing as a mistake, but rather a deliberate effort to write her as someone whose response to trauma is not nearly as often seen in media. The pervasive image of a victim that has suffered what Jessica has suffered is someone blubbering in a corner and essentially wrecked, afraid of men, afraid of people, afraid of life in its entirety. âSomeone who cries is exposing weakness.â is the underlying message. Jessica nearly cries on many occasions after suffering a flashback or a nightmare, but she centers herself and shakes herself out of it because doing so comes more naturally to her than it may for others. I donât really know how to explain it, but itâs not that people who âallowâ their trauma to affect them are weak, but rather some people are able to mentally shake themselves out of its hold if given the proper tools to do so at a steadier clip than others. Predisposed skill level at processing trauma, and itâs a skill you learn and develop as time goes on, hopefully. Not all minds react to trauma the same way. Jessica fears Kilgrave, but she also hates him, she hates him in a way that translates to âI would lay my hands on you to remove you from my presenceâ, i.e. physical, verbal confrontation and rebuffs, whereas other forms of hatred that stem from trauma seem to be âI would do everything in my power to remove myself from your presenceâ, i.e. avoidance, hiding. Season 1 to me felt like a war between both instincts, and ultimately Jessica chose the former.Â
This isnât to say that one must always choose to directly confront the source of their trauma and terminate it, since I think people can recover   Jessica has shades of that, and it is a battle throughout the season of âDo I avoid him or do I confront him?â Â
She is a very shut-off person, really compartmentalizes everything while trying to make it seem like what happened to her doesnât affect her, but only in front of strangers. When she is with Kilgrave she goes out of her way to remind him âHey, you fucked me up, did you know that? YOUR CRIMES AGAINST MY PERSON FUCKED ME UP.â And he doesnât know how to comprehend that. He expresses his disgust for the word ârapeâ because he believes the myth that rapists are the kind of people that hide in dark alleyways or skulk around skeevy dive bars. Theyâre cowardly, pathetic little men that resort to force because they canât seduce a woman properly. But he! He is a suave well-dressed man with refined tastes! Women fall head over heels for him (until they realize heâs a horrible person, then they try to leave only to find they canât). How many rapists attract the number of women he does? How many rapists are able to get a woman to say âyesâ without laying a hand on her? How many rapists shower their victims with expensive gifts and attention? How many rapists love their victims?Â
Zero! So that means heâs not a rapist, obviously! To be accused of rape is a big existential threat to him. It would mean challenging the nature of the relationship that he has created in his mind between him and Jessica. He came to think there was genuine love between them and he somehow lost her, or he failed to pick up on something and she ran away. He blames her for breaking his heart, but at the same time he comes close to admitting that maybe he did something wrong and it made her angry, so he should at least try to fix it to make her happy, as if she got fed up with him coming home late from the office one too many times. You know, something objectively minor but still considered important in her overdramatic female mind. I should note that Kilgrave does not come off as a man who thinks less of women for being women, but believes they are a bit different from men ala âWomen are from Venus, Men are from Marsâ. Women require different handling; they donât always say what they want because they donât want to admit that they want things. That ties into Jessicaâs statement that she doesnât flirt, she states what she wants. But Kilgrave demonstrates that even when a woman states in plain terms what she wants, men assume the woman is lying, in denial, means the opposite, or she can be persuaded...Â
Itâs the discounting and downplaying of Jessicaâs claims that really sell how far up his own ass Kilgrave really is.Â
So in short:
Psychopathy + male chauvinism + Unfettered infatuation + Persuasion virus = The Biggest Recipe for Disaster in the History of Gender Relations Ever
#this is basically just a bunch of thoughts written down with some coherency#these points have likely been touched on before but if I want to get this bastard out of my system I need to write them down#kilgrave#jessica jones#character analysis
10 notes
¡
View notes
Link
Written by Pascal Chambon, reviewed by RaphaĂŤl Gomès Update: this article mostly deals with the RESTish ecosystem, which now constitutes a major part of webservices. For more in-depth analysis of the original REST, and of HATEOAS, see my follow-up article. How come REST means so much WORK? This is both a paradox, and a shameless pun. Letâs dive further into the artificial problems born from this design philosophy. BEWARE : through this document, youâll encounter lots of semi-rhetorical technical questions. Do not misunderstand them, they DO NOT mean that RESTish webservices canât solve these problems. They just mean that users have an extra burden of decisions to take, of extensions to integrate, of custom workarounds to apply, and this is a problem in itself. The joy of REST verbsRest is not CRUD, its advocates will ensure that you donât mix up these two. Yet minutes later they will rejoice that HTTP methods have well defined semantics to create (POST), retrieve (GET), update (PUT/PATCH) and delete (DELETE) resources. Theyâll delight in professing that these few âverbsâare enough to express any operation. Well, of course they are; the same way that a handful of verbs would be enough to express any concept in English: âToday I updated my CarDriverSeat with my body, and created an EngineIgnition, but the FuelTank deleted itselfâ; being possible doesnât make it any less awkward. Unless youâre an admirator of the Toki Pona language. If the point is to be minimalist, at least let it be done right. Do you know why PUT, PATCH, and DELETE have never been implemented in web browser forms? Because they are useless and harmful. We can just use GET for read and POST for write. Or POST exclusively, when HTTP-level caching is unwanted. Other methods will at best get in your way, at worst ruin your day. You want to use PUT to update your resource? OK, but some Holy Specifications state that the data input has to be equivalent to the representation received via a GET. So what do you do with the numerous read-only parameters returned by GET (creation time, last update time, server-generated tokenâŚ)? You omit them and violate the PUT principles? You include them anyway, and expect an âHTTP 409 Conflictâ if they donât match server-side values (forcing you to then issue a GET...)? You give them random values and expect servers to ignore them (the joy of silent errors)? Pick your poison, REST clearly has no clue what a read-only attribute it, and this wonât be fixed anytime soon. Meanwhile, a GET is dangerously supposed to return the password (or credit card number) which was sent in a previous POST/PUT; good luck dealing with such write-only parameters too. Did I forget to mention that PUT also brings dangerous race conditions, where several clients will override each otherâs changes, whereas they just wanted to update different fields? You want to use PATCH to update your resource? Nice, but like 99% of people using this verb, youâll just send a subset of resource fields in your request payload, hoping that the server properly understands the operation intended (and all its possible side effects); lots of resource parameters are deeply linked or mutually exclusive(ex. itâs either credit card OR paypal token, in a userâs billing info), but RESTful design hides this important information too. Anyway, youâd violate specs once more: PATCH is not supposed to just send a bunch of fields to be overridden. Instead, youâre supposed to provide a âset of instructionsâ to be applied on the resources. So here you go again, take your paperboard and your coffee mug, youâll have to decide how to express these instructions. Often with handcrafted specifications, since Not-Invented-Here Syndrome is a de-facto standard in the REST world. (Edit: REST advocates have backpedaled on this subject, with Json Merge Patch, an alternative to formats like Json Patch) You want to DELETE resources? OK, but I hope you donât need to provide substantial context data; like a PDF scan of the termination request from the user. DELETE prohibits having a payload. A constraint that REST architects often dismiss, since most webservers donât enforce this rule on the requests they receive. How compatible, anyway, would be a DELETE request with 2 MBs of base64 query string attached? (Edit: the RFC 2616, indicating that payloads without semantics should be ignored, is now obsolete) REST aficionados easily profess that âpeople are doing it wrongâ and their APIs are âactually not RESTfulâ. For example, lots of developers use PUT to create a resource directly on its final URL (/myresourcebase/myresourceid), whereas the âgood wayâ (edit: according to many) of doing it is to POST on a parent URL (/myresourcebase), and let the server indicate, with an HTTP âLocationâ header, the new resourceâs URL (edit: itâs not an HTTP redirection though). The good news is: it doesnât matter. These rigorous principles are like Big Endian vs Little Endian, they occupy philosophers for hours, but have very little impact on real life problems, i.e âgetting stuff doneâ. By the way⌠handcrafting URLs is always great fun. Do you know how many implementations properly urlencode() identifiers while building REST urls? Not that many. Get ready for nasty breakages and SSRF/CSRF attacks. When you forget to urlencode usernames in 1 of your 30 handcrafted URLs.The joy of REST error handlingAbout every coder is able to make a ânominal caseâ work. Error handling is one of these features which will decide if your code is robust software, or a huge pile of matchsticks. HTTP provides a list of error codes out-of-the-box. Great, letâs see that. Using âHTTP 404 Not Foundâ to notify about an unexisting resource sounds RESTful as heck, doesnât it? Too bad: your nginx was misconfigured for 1 hour, so your API consumers got only 404 errors and purged hundreds of accounts, thinking they were deletedâŚ. Our customers, after we deleted their gigabytes of kitten images by error.Using âHTTP 401 Unauthorizedâ when a user doesnât have access credentials to a third-party service sounds acceptable, doesnât it? However, if an ajax call in your Safari browser gets this error code, it might startle your end customer with a very unexpected password prompt [it did, years ago, YMMV]. HTTP existed long before âRESTful webservicesâ, and the web ecosystem is filled with assumptions about the meaning of its error codes. Using them to transport application errors is like using milk bottles to dispose of toxic waste: inevitably, one day, there will be trouble. Some standard HTTP error codes are specific to Webdav, others to Microsoft, and the few remaining have definitions so fuzzy that they are of no help. In the end, like most REST users, youâll probably use random HTTP codes, like âHTTP 418 Iâm a teapotâ or unassigned numbers, to express your application-specific exceptions. Or youâll shamelessly return âHTTP 400 Bad Requestâ for all functional errors, and then invent your own clunky error format, with booleans, integer codes, slugs, and translated messages stuffed into an arbitrary payload. Or youâll give up altogether on proper error handling; youâll just return a plain message, in natural language, and hope that the caller will be a human able to analyze the problem, and take action. Good luck interacting with such APIs from an autonomous program. The joy of REST conceptsREST has made a career out of boasting about concepts that any service architect in his right mind already respects, or about principles that it doesnât even follow. Here are some excerpts, grabbed from top-ranked webpages. REST is a client-server architecture. The client and the server both have a different set of concerns. What a scoop in the software world. REST provides a uniform interface between components. Well, like any other protocol does, when itâs enforced as the lingua franca of a whole ecosystem of services. REST is a layered system. Individual components cannot see beyond the immediate layer with which they are interacting. It sounds like a natural consequence of any well designed, loosely coupled architecture; amazing. Rest is awesome, because it is STATELESS. Yes there is probably a huge database behind the webservice, but it doesnât remember the state of the client. Or, well, yes, actually it remember its authentication session, its access permissions⌠but itâs stateless, nonetheless. Or more precisely, just as stateless as any HTTP-based protocol, like simple RPC mentioned previously. With REST, you can leverage the power of HTTP CACHING! Well here is at last one concluding point: a GET request and its cache-control headers are indeed friendly with web caches. That being said, arenât local caches (Memcached etc.) enough for 99% of web services? Out-of-control caches are dangerous beasts; how many people want to expose their APIs in clear text, so that a Varnish or a Proxy on the road may keep delivering outdated content, long after a resource has been updated or deleted? Maybe even delivering it âforeverâ, if a configuration mistake once occurred? A system must be secure by default. I perfectly admit that some heavily loaded systems want to benefit from HTTP caching, but it costs much less to expose a few GET endpoints for heavy read-only interactions, than to switch all operations to REST and its dubious error handling. Thanks to all this, REST has HIGH PERFORMANCE! Are we sure of that? Any API designer knows it: locally, we want fine-grained APIs, to be able to do whatever we want; and remotely, we want coarse-grained APIs, to limit the impact of network round-trips. Here is again a domain in which âbasicâ REST fails miserably. The split of data between âresourcesâ, each instance on its own endpoint, naturally leads to the N+1 Query problem. To get a userâs full data (account, subscriptions, billing informationâŚ), you have to issue as many HTTP requests; and you canât parallelize them, since you donât know in advance the unique IDs of related resources. This, plus the inability to fetch only part of resource objects, naturally creates nasty bottlenecks (edit: yes, you can stuff extensions like Compound/Partial Documents into your setup to help with that). REST offers better compatibility. How so? Why do so many REST webservices have â/v2/â or â/v3/â in their base URLs then? Backwards and forward compatible APIs are not hard to achieve, with high level languages, as long as simple rules are followed when adding/deprecating parameters. As far as I know, REST doesnât bring anything new on the subject. REST is SIMPLE, everyone knows HTTP! Well, everyone knows pebbles too, yet people are happy to have better blocks when building their house. The same way XML is a meta-language, HTTP is a meta-protocol. To have a real application protocol (like âdialectsâ are to XML), youâll need to specify lots of things; and youâll end up with Yet Another RPC Protocol, as if there were not enough already. REST is so easy, it can be queried from any shell, with CURL! OK, actually, every HTTP-based protocol can be queried with CURL. Even SOAP. Issuing a GET is particularly straightforward, for sure, but good luck writing json or xml POST payloads by hand; people usually use fixture files, or, much more handy, full-fledged API clients instantiated directly in the command line interface of their favorite language. âThe client does not need any prior knowledge of the service in order to use itâ. This is by far my favourite quote. Iâve found it numerous times, under different forms, especially when the buzzword HATEOAS lurked around; sometimes with some careful (but insufficient) âexceptâ phrases following. Still, I donât know in which fantasy world these people live, but in this one, a client program is not a colony of ants; it doesnât browse remote APIs randomly, and then decide how to best handle them, based on pattern recognition or black magic. Quite the opposite; the client has strong expectations on what it means, to PUT this one field to this one URL with this one value, and the server had better respect the semantic which was agreed upon during integration, else all hell might break loose. When you ask how HATEOAS is supposed to work.How to do REST right and quick?Forget about the ârightâ part. REST is like a religion, no mere mortal will ever grasp the extent of its genius, nor âdo it rightâ. So the real question is: if youâre forced to expose or consume webservices in a kinda-RESTful way, how to rush through this job, and switch to more constructive tasks asap? Update: it turns out that there are actually lots of âstandardsâ and industrialization efforts for REST, although I had never encountered them personnally (maybe because few people use them?). More information in my follow-up article. How to industrialize server-side exposure?Each web framework has its own way of defining URL endpoint. So expect some big dependencies, or a good layer of handwritten boilerplate, to plug your existing API onto your favorite server as a set of REST endpoint. Libraries like Django-Rest-Framework automate the creation of REST APIs, by acting as data-centric wrappers above SQL/noSQL schemas. If you just want to make âCRUD over HTTPâ, you could be fine with them. But if you want to expose common âdo-this-for-meâ APIs, with workflows, constraints, complex data impacts and such, youâll have a hard time bending any REST framework to fit your needs. Be prepared to connect, one by one, each HTTP method of each endpoint, to the corresponding method call; with a fair share of handmade exception handling, to translate passing-through exceptions into corresponding error codes and payloads. How to industrialize client-side integration?From experience, my guess is: you donât. For each API integration, youâll have to browse lengthy docs, and follow detailed recipes on how each of the N possible operations has to be performed. Youâll have to craft URLs by hand, write serializers and deserializers, and learn how to workaround the ambiguities of the API. Expect quite some trial-and-error before you tame the beast. Do you know how webservices providers make up for this, and ease adoption? Simple, they write their own official client implementations. FOR. EVERY. MAJOR. LANGUAGE. AND. PLATFORM. Iâve recently dealt with a subscription management system. They provide clients for PHP, Ruby, Python, .NET, iOS, Android, Java⌠plus some external contributions for Go and NodeJS. Each client lives in its own Github repository. Each with its own big list of commits, bug tracking tickets, and pull requests. Each with its own usage examples. Each with its own awkward architecture, somewhere between ActiveRecord and RPC proxy. This is astounding. How much time is spent developing such weird wrappers, instead of improving the real, the valuable, the getting-stuff-done, webservice? Sisyphus developing Yet Another Client for his API.ConclusionFor decades, about every programming language has functioned with the same workflow: sending inputs to a callable, and getting results or errors as output. This worked well. Quite well. With Rest, this has turned into an insane work of mapping apples to oranges, and praising HTTP specifications to better violate them minutes later. In an era where MICROSERVICES are more and more common, how come such an easy task â linking libraries over networks â remains so artificially crafty and cumbersome? I donât doubt that some smart people out there will provide cases where REST shines; theyâll showcase their homemade REST-based protocol, allowing to discover and do CRUD operation on arbitrary object trees, thanks to hyperlinks; theyâll explain how the REST design is so brilliant, that Iâve just not read enough articles and dissertations about its concepts. I donât care. Trees are recognized by their own fruits. What took me a few hours of coding and worked very robustly, with simple RPC, now takes weeks and canât stop inventing new ways of failing or breaking expectations. Development has been replaced by tinkering. Almost-transparent remote procedure call was what 99% people really needed, and existing protocols, as imperfect as they were, did the job just fine. This mass monomania for the lowest common denominator of the web, HTTP, has mainly resulted in a huge waste of time and grey matter. REST promised simplicity and delivered complexity. REST promised robustness and delivered fragility. REST promised interoperability and delivered heterogeneity. REST is the new SOAP. EpilogueThe future could be bright. There are still tons of excellent protocols available, in binary or text format, with or without schema, some leveraging the new abilities of HTTP2⌠so letâs move on, people. We canât forever remain in the Stone Age of Webservices. Edit: many people asked for these alternative protocols, the subject would deserve its own story, but one could have a look at XMLRPC and JSONRPC (simple but quite relevant), or JSONWSP (includes schemas), or language-specific layers like Pyro or RMI when for internal use, or new kids in the block like GraphQL and gRPC for public APIs⌠âAlways finish a rant on a positive noteâ, momma said.Edited on December 12, 2017: normalize section titlesremove some typosrectify improper âHTTP redirectionâ wording after POST operationsadd suggestions of alternative protocolsEdited on December 28, 2017: fix mixup between âHTTP methodsâ and âREST verbsâEdited on January 7, 2018 Edited on January 19, 2018 fix wrong wording on âPUT vs GETâ remarksprecise the notion of âreal APIsâ (non-CRUD)mention risk of overrides with PUTupdate paragraphs on PATCH and DELETE troublesEdited on January 19, 2018 fix wording around Not-Invented-Here SyndromeEdited on February 2, 2018 add links to follow-up article on The Original REST, in âintroductionâ and âhow to industrializeâ chaptersEdited on April 14, 2019 add clarification about âsemi-rhetorical questionâ, and hints about extensions like compound/partial documentsEdited on July 6, 2019 fix typos and French links
0 notes