The more I work with Windows Communication Foundation the more I see it as an extraordinary piece of technology. With the ability to easily extend and intercept messages it's much more dynamic than any other programming stack for distributed applications I've come across (thus far). Apparently Juval Löwy is of the same opinion. Via UDI ( http://udidahan.weblogs.us/2007/12/29/wcf-everywhere-not-on-my-watch/ ) I found an ARCast with Juval and Ron Jacobs where Juval has the radical suggestion that WCF should be the object runtime of .NET, he wants every class to be a WCF service. You can see the full cast over here: http://channel9.msdn.com/ShowPost.aspx?PostID=347010
His argument is that in WCF it's really easy to apply cross-cutting concerns like transactions and security to objects without burdening the developer with the plumbing code. A lot of code that is being written is just plumbing and WCF can help you reduce the amount of plumbing code.
For instance; In a recent project, with just a couple of lines of code, I managed to extended the WCF message dispatch mechanism to automatically create a new LINQ To SQL DataContext and dispose it for every call to an operation. Once the code for handling the cross-cutting concern was written, it was really easy to apply a decorator for each operation that should have that particular behavior:
[AutomaticDataContext]
public List<Customer> GetTop10Customers() { . }
Now where have I've seen this capability before, I wonder..
Oh wait I got it: In AOP!
I agree with Juvals argument that often the level of abstraction for plumbing is too low, it needs to be higher and we need a better way of applying cross-cutting concerns across our systems. But I'm not sure that WCF is the solution, not in its current state anyway.
WCF and the functionality there in is mainly architectured for distributed scenarios, Juval says it the best himself when he in the ARCast calls the WS-* specs for "Wire Specs" I.e what goes on the Wire. Well, YAGNI is all I have to say about that.
Instead, I would like to see Microsoft open the instantiation and dispatch mechanism of the CLR for extensibility. WCF would benefit from that, so would all the LINQ implementations and everything else you might come across that have cross-cutting concerns. Additionally we would at least be able to build intercepting runtimes even if it wouldn't be fully fledged AOP frameworks.