I was asked to review a system the other day that was based on ASP.NET MVC + CSLA + DDD (domain drive design). The first version of this system was based on ASP.NET MVC + CSLA. The second release was based on that plus added DDD. The reason is because..... well, I don't know what. As I looked at the diagrams from the two different architectures, it was pretty apparent that the second version was extremely more complex. The CSLA objects basically used the Domain objects. When you see something like this you know it already smells but it is hard to justify why someone shouldn't do it this way without A) having extreme knowledge of all topics or B) using it for a long time. I have neither of these for this topic but I know if I'd built this from scratch I wouldn't have done it this way, nor wouldn't a lot of developers I associate with.
So, dear reader, what would you do in this situation? My thoughts are that if you want to use CSLA and MVC and DDD then you make a stand and chose one or another (CSLA or DDD). If you don't there are too many cooks in the kitchen.
Please shed some insight if you have opinions on this matter.
My thoughts are that if you want to use CSLA and MVC and DDD then you make a stand and chose one or another (CSLA or DDD). If you don't there are too many cooks in the kitchen.
I tend to agree with you there. If someone wants to do DDD with an already flushed out DDD friendly architecture + supporting frameworks, I'd recommend S#arp Architecture over CSLA.
That being said, some people feel it is possible to take on some of the aspects of DDD using CSLA. Obviously a DDD purist would probably cringe at that prospect, but you don't have to be a purist to gain something from DDD. Derick Bailey has an interesting blog regarding the topic: http://www.avocadosoftware.com/csblogs/dredge/archive/2007/02/19/687.aspx
In my opinion, CSLA shot itself in its foot with the latest version. Opinions differ, but it's so wrong, in my book, when an object has to know if it is a child or not.
It seems that some people out there are finding that CSLA and DDD / Alt.Net are not entirely a cross-purposes.
I'd still agree that you probably have quite a bit of work to do to adapt the good work that Rocky has done if you decide that you want to follow a more purist and less pragmatic path, and as Keith has suggested, it could be easy to just create a mess if you're not careful.
Some further info:
Using Dependency Injection with CSLA.NET
Using the Repository Pattern with CSLA.NET
Rocky on why he's committed to building a 'pragmatic' framework
I am not sure CSLA which from memory uses an ActiveRecord approach is particularly suited to DDD. Better off with nHibernate.
来源:https://stackoverflow.com/questions/775465/is-asp-net-mvc-csla-ddd-possible