I’ve been thinking a lot lately about the best way to construct "Web 2.0"-style applications. I posted before about how AJAX and Flash apps have almost returned to a client-server model again, with much more of the application living on the client instead of on the server. I don’t know that I’ve seen a satisfactory solution to this question yet.
There seem to be two main schools of thought around this right now. One is that most of the application lives on the client in Javascript or Flash, and just uses the server for storage. NetVibes and quite a few of the "Web 2.0" apps are examples of this type of architecture. The other is that most of the application lives on the server, which is responsible for rendering most the application, and the client is made up of some widgets and controls that interact with the user and send information back to the server for processing and storage. Microsoft’s Atlas framework is a prime example of this type of architecture.
This almost goes back to the whole object-oriented vs. SOA debate. The "mainly-client" applications tend to be more object oriented, while the "mainly-server" applications tend to be service-oriented. I don’t feel that either of these are ideal. I think we’re at the point where we need to marry both of these approaches for an ideal application architecture. Object-oriented on the client is very good, but the client isn’t suited for heavy lifting like servers are. Servers are great at heavy lifting, but they aren’t so good at creating a rich user experience.
I think what’s needed is a hybrid approach. I love the idea of having a rich object model on the client, at least up to the point that Javascript allows. With some hacks, you can simulate multiple levels of inheritence and some pretty nifty object oriented constructs. What I’ve been toying with lately is the idea of creating object proxies on the client that are coupled to the "real" objects on the server using SOA. The client objects would have all of the same properties and methods as the objects on the server, but the guts of the objects would actually live on the server. The server essentially just accepts the data from the client-side Javascript and passes it back to the server using SOAP or REST, gets the value, and passes it back. Transparent to the script on the client, but it essentially offloads the real work to the server. The server can then do whatever it needs with that data, including passing it off to a message queue, re-routing the request to another server using SOA, etc. In a sense it’s the loosest coupling you can get, it’s decoupling the objects on the client itself from the server. It’s using SOA as the plumbing behind the client object.
What I’d like to do is create, say, a Person object on the client which is coupled to a person record on the server (in the database or in XML). All the property changes would be done on the client, but when the user saves the object, the client object would then use SOAP or REST to call the Save method on the server, passing with it the properties of the client object in JSON format. Same with loading an object getting an object, the client should just send the object ID to the server and ask for the full contents which the server would return using JSON, and then probably cache it on the client for future use. The client objects’ base classes would also have the inherent ability to render itself to HTML, return its XML for Live Clipboard use, etc.
Maybe somebody’s already developed something like this, but I haven’t been able to find it yet. I don’t want to be tied to any specific development language on the server, either, so libraries like Ajax.NET that generate the client objects from the server code aren’t really what I’m looking for. I’m interested in an actual object library for use on the client that communicate directly with the server in the appropriate places. The Javascript libraries like Dojo have just matured enough to enable this pretty recently (in my opinion, anyway). If anyone has seen anything along these lines I’d really appreciate a link.








