you are here

Code-on-Demand… Like it’s 1985

As promised, I wanted to take a few minutes to share my opinion the only optional REST constraint, Code-on-Demand.

Being optional, and perhaps seemingly impractical it’s no surprise that most RESTful APIs choose to bypass this constraint.  Especially as REST is used tremendously for web applications, meaning that it would need to be compatible with any client that would be using it- ie supporting Java, .Net, PHP, Ruby, Perl, Python, Objective-C, Swift… the list goes on and on.

In reality, I can’t blame anyone for not taking advantage of this constraint.  But at the same time, I can’t help but think that Dr. Roy Fielding was well beyond his time (when he wrote this back in 2000).  After all, code-on-demand has the potential to fix one of the greatest pain points we as API developers face, keeping software up to date with our APIs, and preventing backwards compatibility issues (especially with SDKs).

Just bear with me, for a couple minutes here, because I’m about to sound crazy.  Just like Marty McFly would as he described self-tying/ pumping shoes, hover boards, and flying cars in 1985 (kudos to those of you who figured that out right away).

Imagine having the ability to have your software be intelligent enough to change with the API, to automatically add new data fields/ requirements, to provide patched validations without having to use a precious API call, or even enable new features on the fly.  In essence, a self-learning, adaptable application.  Of course, this would raise substantial security concerns- as any API capable of updating its own code is capable of importing malicious code onto your server… setting us up for one of the greatest hacks of all time.

But imagine being able to create automatic updates for your users, removing the pain point of forcing them to manually upgrade to the latest version, and also reducing friction on your end as you no longer have to worry about backwards compatibility with your code (assuming a private API).

While often the most ignored REST constraint, I think in the next few years we will be seeing code-on-demand playing more and more of a crucial role in software – especially in APIs.

And I think that as much fun as the skeptics are having with this notion now, in the end we’ll find that Dr. Roy Fielding was absolutely right… just living in the wrong decade.

Share this Page:
Facebook Twitter Linkedin Reddit Tumblr Email

Leave a Reply

Your email address will not be published. Required fields are marked *