Designing distributed applications using static typing and RESTful services
Over the last few months I've often come across the same Design obstacles when developing certain kinds of distributed applications.
Firstly, let me set out my environment, and distributed applications:
- .NET enviroment
- All communication is done over HTTP
- Applications are often on different servers
- Usually is a combination of Web Application and desktop services.
- Usually, the desktop services service many web applications, so you could say it's a one to many relationship, where the windows service might poll the different web apps for different data and feedback.
Now, in a .NET environment, let me first set out that I would rather not use SOAP specifically, 开发者_StackOverflow社区or even WCF generally.
This is because I'd like to keep the communication really simple.
This means I'll be throwing round simple XML back and fourth. However, I'd like all my API calls to be statically typed and to be dealing with Classes, rather than raw XML.
This is because I think it's much nicer and easier for a new developer to come to an API, and have it have simple objects with properties, instead of having to construct and deconstruct XML.
Usually what I do is then have a serialize and deserialize methods at the interface level.
So far, so good. Now here come the problems
What I usually do then is build a single dll that define these classes, and the serializing methods, and I drop them in all the nodes.
The advantage is I have one source code, one solution to change, and it means all nodes have definitions of everything, and yet they are able to communicate using simple RESTful services, and XML.
The obvious downfall is that now updating that library becomes problematic, as there are dll everywhere.
So, my question. Could you guys suggest anything, or point me to some useful patterns?
The simple solution would be to use something like SOAP or some config of WCF, because then I could share class definitions over the wire. However, I don't want to do that.
cheers!
I'm shocked this question did not get a ton of answers. I would love to give you a longer soapbox rant, but I don't have time :-)
I really don't recommend distributing objects as it been demonstrated in the past to be full of problems. However, if you must, you might want to consider that the latest version of Silverlight is using MEF to download assemblies on demand. You may be able to use MEF to do something similar.
精彩评论