This is your brain on multiple tiers
Fowler’s first law of distributed object design: “Don’t distribute your objects”
Just because we have created better, more efficient, more secure, or even “sexy” ways of distributing our applications that doesn’t make it right in and of itself. WCF, a formidable follow up to Web Services, has given us the tools we need to enable cross machine, cross application, inter-enterprise communication when we need to do it. The fact of the matter is that we don’t need to do it as often as we think we do.
It is amazing how many application design efforts just assume a WCF service layer out of the box for no other reason than a desire to be "Service Oriented". Admittedly, there are viable reasons to have a multi-tier application. One common situation is a web application that needs to talk to a database that it cannot see directly, it needs to go thru an application server to get there. Once we proven to ourselves that we have to have a distributed architecture and we have no way to avoid it, then solving the problem that, to many, seems like a no-brainer, can get our code in the weeds in hurry if we don't understand the price that must be paid to have a true service layer. In Fowler's Errant Objects Article for Dr Dobbs he states what our willingness to distribute our application should be: "If you’re sensible, you’ll fight like a cornered rat'. I think that pretty much sums it up.
Well, like it or not, we will need to solve this problem more often than not, so how do we go about doing it well? A new book by Dino Esposito digs into just this question in great detail and I think it is one of the better attempts to clarify a subject that is misunderstood more often than not. I really like how he takes a Fowler's Enterprise Application Architectures and applies them to design decisions in a pragmatic, non-religious way.
I am still not sold on how best to solve the service layer problem in an application that doesn't need to be service oriented but needs to be distributed. Any suggestions?
© Copyright 2009 - Andreas Zenker