Layered Architecture vs Living Domain Model
Update: Fowler has blogged about this.
I just finished a great talk with Jon Tirsen, basically he points out that a layered architecture can get between you and your domain model.
We were discussing that the "small talk way" (i.e. the OO way) is to have a rich, living, useful domain model that does all the interesting things in your application.
If you have a layered architecture, you can end up having a service layer that seperates your client code (view or action) from your domain model.
Jon pointed out that having one of these layers, when you dont need one, is like burning $50 notes. You end up writing hundreds of lines of code in your service layer including marshalling and unmarshalling across the boundaries.
Another bad effect is that teams often end up implementing functionality as transaction scripts rather than in the domain where it belongs. The more you do this, the more anemic your domain model becomes, and the less useful your domain language becomes for solving problems in the future.
The advice from all this is that the one kind of appliction that does NOT need a layered architecture is a web application. Your views can and should have a rich and close collaboration with your domain code.
This conversation really got me thinking, is it actually possible to maintain a living domain model with a service layer in the way?