November 14, 2007
I have read a lot of talks recently about APIs. Google APIs, Facebook APIs, OpenSocial APIs, APIs for making coffee and strawberry jam and so on. As a computer scientist I resent the fact that all those efforts are still made on a very primitive level. None of the new or old software industry bulldozers are trying to making it easy for developers. Not true. They are trying, but with the wrong ideas.
For the past years I have been involved in building an inference engine for putting together a set of reusable components for automated reasoning services (commonly known as artificial intelligence). This is part of my PhD thesis that I am hoping to finish next semester. Many inference engines already exist, however the idea of our research group (it´s very much a collective effort that I am part of) was to try a radically model-driven approach. This means, instead of diving from the very beginning into Java or C++ complexity, we took our time to think the architecture of our inference engine as a set of well-defined components that any engineer could look at and within a few minutes understand the services that such component provides.
Yeah, I know. Software engineering bla bla bla. Well, that was exactly what I thought in the beginning. But let me tell you what really happened: after 3 years reading lots of math and logical stuff I finally was ready to project a few components that realize the set of services we were interested in. Although I was dying to implement them right away in Java I took the time to do two things: I figured out the basic functionality I wanted to together with the data structures, then using only UML class/component diagrams I model each basic functionality. And then I used an old software engineering idea, design by contract, to link together the components services (actually methods) through pre- and post-conditions.
I used a new standard from the Object Modeling Group (OMG) called the Object Constraint Language (OCL) to specify the stuff. Mind you, you could use Java as well or any of these new Java flavors to write these constraints. What happened next was that I found out that by using only OCL I could fully express not only the structure of my data but also the behaviour of each component. So as it turned out I did not have a dead model, that would be forgotten as soon as I started my Java implementation. I had a complete system that lacked only the tools to be executed (e.g. a transformation from OCL to Java or to C++).
Then back to my point in this posting: why Google, Microsoft, Yahoo, Salesforce (ok maybe their new platform has some of the things I am talking about here) do not try this leap? I was browsing the other day the OpenSocial API from Google and it really sucks all those hundreds of lines of code. Why is it so hard to present a graphical model of the stuff with nice well-defined interfaces that we just could browse, drag and drop and build the applications much easier? After all, it´s almost a bunch of SQL queries and read/write operations.
It´s a kingdom of coders out there. That´s why. And for some strange, unconscious or conscious reason, those guys are not letting go off their kingdom. Once we have Component-based systems on the web, not only techies will build software. I bet almost everybody that has an engineering background or even is good at logics and math will do. So is this the real motivation of everybody in the software industry to postpone model-driven development or am I just being paranoid?