Skip to main content

Giving it a REST


I don’t remember deciding that I was a fan of REST APIs, but I found myself in that position for a lot of years. I was really only getting to the point as a developer that I was even thinking about APIs around the time when REST was already on the scene, and especially was getting more popular among the Python community and among the Web developer communities, the two places I drew most of my social influence from in the are of programming.

SOAP was not a disaster that I had really much experience in, save for a couple very brief encounters. One of my first small programming contracts was actually wrapping a SOAP service into a RESTful endpoint. The main business model of my client was reselling another service because developers would prefer to use this improved API that much more that the small premium would be worth it. I was young and impressionable and looking back, I don’t know if the SOAP API I had to work with directly for this job was actually as bad as it was made out to be or if it was me picking up the tone of the job. And, I think, interacting with SOAP services probably is different in different languages, and maybe doing it in Python from scratch and entirely by hand was definitely more painful than some more strict languages with heavier SOAP tooling in their ecosystems.

So these ideas I’ve held for so long about how great REST is and how awful SOAP was are not ideas I can really trace back to experience or education. They’re things that I largely picked up socially. SOAP was always the poster child for the wider idea of RPC (Remote Procedure Call) APIs, but the negative tone was definitely equally applied to any similar system (which was almost always XML based, of course).

A tale I’ve heard about an experiment involving social pressure and monkeys goes like this. The scientists had a cage with a bunch of monkeys and they had a ladder in the center that let them to some treat up at the top. Immediately the monkeys tried to get there, but when they would try someone would spray them with a hose and get them off the ladder and repeat this until none of the monkeys would even try. When all of the monkeys had learned this lesson, they removed one monkey and replaced him with a new monkey, who didn’t know about the ladder and tried to get the treat. The hose was used again, and all the monkeys were punished. The monkeys were replaced like this, one by one, until they learned to self police and stop any new monkey from trying to climb the ladder. The hose wasn’t even needed. Eventually, none of the monkeys in the cage had ever even seen the hose, but they all knew what to do when someone climbed the ladder.

Some times I feel like we’re all the monkeys and RPC is that treat at the top of the ladder. And maybe, in this scenario, SOAP is the actually ladder? The point is, I feel like we all avoid this thing we don’t really understand and we do so based on the experience of others we’ve gleaned from, about something we don’t actually understand beyond the surface fear of.

At this point I feel like I don’t know what I missed or left behind, and I’m not just abandoning REST (nor could I, as it is inescapable in the current landscape) but I want to recognize that learning more about alternatives is something I’d like to do. I know SOAP enough to know I don’t want to get to know it better, but I also feel like tooling is a missing piece here. I want to understand, with the right tooling in place, how much less might I care about the protocol being used and what else might I value in that protocol?

Comments

Popular posts from this blog

CARDIAC: The Cardboard Computer

I am just so excited about this. CARDIAC. The Cardboard Computer. How cool is that? This piece of history is amazing and better than that: it is extremely accessible. This fantastic design was built in 1969 by David Hagelbarger at Bell Labs to explain what computers were to those who would otherwise have no exposure to them. Miraculously, the CARDIAC (CARDboard Interactive Aid to Computation) was able to actually function as a slow and rudimentary computer.  One of the most fascinating aspects of this gem is that at the time of its publication the scope it was able to demonstrate was actually useful in explaining what a computer was. Could you imagine trying to explain computers today with anything close to the CARDIAC? It had 100 memory locations and only ten instructions. The memory held signed 3-digit numbers (-999 through 999) and instructions could be encoded such that the first digit was the instruction and the second two digits were the address of memory to operat...

Statement Functions

At a small suggestion in #python, I wrote up a simple module that allows the use of many python statements in places requiring statements. This post serves as the announcement and documentation. You can find the release here . The pattern is the statement's keyword appended with a single underscore, so the first, of course, is print_. The example writes 'some+text' to an IOString for a URL query string. This mostly follows what it seems the print function will be in py3k. print_("some", "text", outfile=query_iostring, sep="+", end="") An obvious second choice was to wrap if statements. They take a condition value, and expect a truth value or callback an an optional else value or callback. Values and callbacks are named if_true, cb_true, if_false, and cb_false. if_(raw_input("Continue?")=="Y", cb_true=play_game, cb_false=quit) Of course, often your else might be an error case, so raising an exception could be useful...

Announcing Feet, a Python Runner

I've been working on a problem that's bugged me for about as long as I've used Python and I want to announce my stab at a solution, finally! I've been working on the problem of "How do i get this little thing I made to my friend so they can try it out?" Python is great. Python is especially a great language to get started in, when you don't know a lot about software development, and probably don't even know a lot about computers in general. Yes, Python has a lot of options for tackling some of these distribution problems for games and apps. Py2EXE was an early option, PyInstaller is very popular now, and PyOxide is an interesting recent entry. These can be great options, but they didn't fit the kind of use case and experience that made sense to me. I'd never really been about to put my finger on it, until earlier this year: Python needs LĂ–VE . LĂ–VE, also known as "Love 2D", is a game engine that makes it super easy to build ...