Ode to a dumb server

RIA development is a funny thing. A smarter client means that your server code is no longer all about handling display logic. Instead, you’re in charge of feeding data (typically XML documents) to the client whenever it asks for some, and handling any database updates (typically XML documents again) that might be needed.


Because my dev team are 1)a bunch of brainiacs, and 2) quite lazy (they’re not big fans of writing a 250 class program that does something simple) they�ve been digging deep into the XML support that SQL Server 2000 provides (I assume that Oracle provides equivalent functionality: please don’t drag me into a boring religious argument about RDBMS vendors. We happen to be running SQLServer for this project). If they sweat enough over the query design, they end up with an xml file that is exactly what the Flash programmer asked for. And if they sweat enough over the stored procedures that save updates, they can accept the xml files coming from the client as is. This reduces your server-side code to the following:
* Accept request (typically an XML document)
* Authenticate
* Determine what is being asked for (via a simple controller that reads the http request parameters)
* Call the appropriate Stored Procedure (passing the XML document as a parameter)
* Send the resulting XML file to client
No relational database / object impedance mismatch. Heck, not a lot of objects! We don�t need no stinkin’ hibernate! We don�t need JAXB! And we sure as hell don’t need 100s of hand-tooled classes, each representing a different table in the database. As the database and the client get smarter, the server can become a lot dumber. And that�s a good thing, ’cause code bloat on the server costs serious money (read: more servers) once you start getting real traffic.
The functionality / lines of code ratio that we’re getting with this pattern is off the charts. Of course, each line of code does take longer to write when you’re writing complicated sql queries instead of 100s of getter and setter functions ;->. Still, we’re seeing a huge productivity gains from the “dumb server” pattern of RIA development.