del.icio.us del.icio.us
Digg Digg
DZone DZone
Furl Furl
Reddit Reddit





 Subscribe in a reader



01/26/10 :: [REST] 2010 - Where are We? [permalink]

A post by William Vambenepe, and the comments that followed, prompted me to do a reality check: here we are, 3 years after the 2nd invasion of RESTafarians in our industry. That wave has kind of succeeded. "REST" APIs are everywhere. I put REST in quotes because the number of RESTful APIs are far fewer than the self-proclaimed ones. Even the hard core RESTafarians do not bother policing the ugly world they have created anylonger.

Take this payment API. Is that RESTful?

POST /<path>/charge?version=1.0&endUserId=tel:+447990123456& currency=GBP&amount=1&referenceCode=ABC

Yes, you have seen it you POST a "verb" (the remainder of the API is all verbs to).

But that's not it, check that one. No you are not dreaming. You want to cancel a "reservation", you -of course- use DELETE, and just to be consistent, you use a verb (reserve) and not a noun.

DELETE /<path>/reserve/1234/release?version=1.0

But, who cares, right? the coders have already hidden all that CRUD behind code generators.  Check the kind of code that Bill Burke wants you to write to deal with Hypermedia. While you are at it, I would also look in Bill's post what the JAX-RS code look like:

@Path("/customers")
public interface CustomerClient {

   @Path("{id}")
   @Produces("application/xml")
   public MyResponse getCustomer(@PathParam("id") int custId) throws NotFoundException;
}

Yeap, this looks so much better and different than jax-ws:

@WebService(targetNamespace = "http://duke.org", name="AddNumbers")
public interface AddNumbersIF extends Remote {
    @WebMethod(operationName="add", action="urn:addNumbers")
    @WebResult(name="return")
    public void addNumbers(
        @WebParam(name="num1")int number1,
        @WebParam(name="num2")int number2,
        @WebParam(name="result" mode=WebParam.Mode.OUT) Holder<Integer> result)
        throws RemoteException, AddNumbersException;
}

 

Outstanding job guys ! all this brouhaha to get there. I am in awe. I am glad people get paid for that kind of "work". Some even call themselves "successful entrepreneurs" after producing a few annotations and a couple variations (no kidding).

Yes, REST has won. Not sure what we have won in return, but REST has. So, it is time to share some of the highlights of the Phyrric victory of the RESTafarians:

1) Dave Chappell - SOA is a failure : I am glad Dave gets paid to travel the world and propagate his boloney - what a job ! Dave (who doesn't write a single line of code) explains that for him "Reuse" doesn't work and the only services worth building are "Data Services". Why reuse don't work? Because:

Creating services that can be reused requires predicting the future… 

Dave, do you understand how reuse works in a distributed system? It is quite easy actually. You need a Forwards Compatible Versioning strategy. You can't reuse what you built 3 years ago, I actually agree with you. But, you can evolve services in a forwards compatible way such that the new version of a service (which was developed to meet the needs of a new consumer) works with all previous consumers without breaking them, and hence without requiring any changes from them. Something that your typical OO library can't do. Reuse in SOA happens the other way around: the old consumers reuse the new version of a service. That way you don't have to predict the future.

2) Stafan Tilkov - Code first does not work : yeap, another rock solid argument. Stefan complains that his code first approach creates "very large WSDL-files". First, REST does not change the footprint of service invocations. If your DTO (aka Resource Representation) is large in WSDL, it will be large in REST, just as well. REST is just a different encoding of the operations (using predefined verbs GET, POST, PUT). Second, You can't do SOA in a "code-first" fashion. I know, even Microsoft does that. I have explained many times that OO is the problem across our industry, any approach that tries to express new semantics on the foundation of OO is bound to fail. Annotating OO or wiring remote calls into and OO runtime is the wrong thing to do. OO is just a particular case of Metamodeling Oriented Programming. OO is not the foundation of programming, let alone software architecture. Semantics need to be expressed independently of the OO metamodel, in particular the semantics of the execution elements.

3) Steve Vinosky, Bill DeHora : The interface to a resource is uniform.. You don't hear that argument very often nowadays, specially after RESTfulie was published, yet it was the core argument when the 2nd invasion started.

... and the list could go, on and on. Stu, let's see what you come up with versioning. I do not wish to add you to this wall of shame.

I can demonstrate that our industry has lost tens of billions of dollars in productivity with these three flawed arguments. In one big swoop, the RESTafarians have prevented reuse to happen, crippled model-driven engineering and the emergence of a distributed programming model which could be the foundation to build composite applications.

In the end, you guys can claim all you want, but REST is just a "NO WS-*" movement. I am not here to defend WS-* or SCA, I don't work for a vendor. I, however, as a user of these technologies, have to constantly talk to people that are often completely confused about all these approaches (I mean really bright experienced people who now think that CRUD is a good way to build distributed systems). I sure wish our industry would have produced by now a nice distributed programming model and made all these discussions pointless. Everyone critically needs it. Unfortunately, as I explained before, there was not a chance, because everything is done from a monolithic programming model point of view, and somehow the gurus like Bill or Steve who had their chance at producing that programming model, project the semantic of a monolithic programming model (OO) into the distributed world. When these people looked at REST, they saw a distributed object paradigm that seemed to work. They looked at all the problems of CORBA (granularity of the calls, brittle interfaces, naming service...) and they felt REST solved elegantly all these questions. REST offered a universal naming service, uniform interfaces and DTO-size granularity. They said Bingo ! and here we are, only ashes are left, they burnt down everything. They have destroyed all the advances that were painfully conquered amongst stupid vendor politics and exacerbated egos. All gone: contracts, forwards compatible versioning, bi-directional interfaces, eventing mechanism, advanced coordination mechanism, assemblies, orchestrations,... you name it. REST doesn't offer any of them. REST brought our industry back to the a pre-Neolithic age and has enslaved everyone to CRUD. The RESTafarians made us lose another 10 years in our quest to built a true distributed programming model.

Congratulations on a job well done ! Mission accomplished !

As for myself, I am not in the business of creating "pretty stories" or attracting "followers". I am just too old-fashioned for that.