I'm a pretty young developer, and still in the emulation phase of my career. I have read a lot about some topics like concurrency, and using unit of work to allow your business layer to control persistence transactions. I have even implemented some painful, but functional code that implements these topics. But I have not really ever seen a real world example of a truly elegant implementation. I don't have a lot of good TDD, pattern focused role models around me, so I'm forced to look at the outside world for guidance.
So, I'm looking for some stellar examples of open source enterprise app domain models. Preferably written in c#, but other languages would be fine as well as long as they are good examples of clean elegant domain model solutions.
Some of the things I would really like to see are elegant solutions for Concurrency, Business Rules and Object Validation, Transactions / Unit of Work, and semi transparent logging mechanisms. I'm also curious to see what some of the real world best practices are for exception handling in domain model code.
I know I could just start tearing into some open source projects at random, and try to decipher the good from the bad, but I was hoping the expert community here would have some good ideas of projects to look at to stream line the effort.
Thanks for your time.
I'm not really interested in frameworks that make design and construction easier. My choice of framework, or whether to use a framework is a necessary consideration, but is entirely separate from my question here. Unless those frameworks are themselves open source, and very good examples to dig through.
What I am looking for is a project that 'got it right', solving a real world problem with code that is flexible, and easily maintainable, so that I can see with my own eyes, and understand an example of how it should be done that is not a trivial 50 line tutorial example.
The C language is not a piece of software but a defined standard, so one wouldn't say that it's open-source, but rather that it's an open standard. There are a gazillion different compilers for C however, and many of those are indeed open-source.
Yes, it's a bit odd that you can get a loud consensus that K&R is a great C book, and also a loud consensus that C99 is the correct/current/best version of C.
I liked lot the architecture of oxite cms at http://www.codeplex.com/oxite. I learned lot from that project. I use nhibernate for data access instead of linq2sql and it works good for me. Of course its not a large scale project but its a perfect start. CSLA does not follow the DDD paradigm.
The above book ".NET Domain-Driven Design with C#" by Tim McCarthy (Wrox Press)" is really good one.
The best book for understanding DDD is Domain-Driven Design: Tackling Complexity in the Heart of Software by Eric Evans. This book is the "bible" of good DDD design.
Beyond that many resources can be found on http://dddcommunity.org/. There you can find more videos and articles from DDD experts including Eric Evans and there is a sample application of good DDD design but unfortunately its in java :(
You could check out nopCommerce i used it to try it work really nice and it has a good implemantation of DDD and BO, quite generic and fast, the install pattern is olso a classic so if you aiming a web apps you could check this out too.
Have a look at Martin Fowler's book, Analysis Patterns. It's an old book, so the class diagrams are not UML but something ancient (fortunately, the front and rear cover contains a description of the diagrams symbols).
And it doesn't have C# code. In fact it doesn't have any code at all because it is not a book about code, but a book about domain models. But it does have domain models to die for!
While it's not exactly what you asked for, Juval Lowy of iDesign has coded up some wonderful WCF Samples that tackle many of the situations you mention above.
The book ".NET Domain-Driven Design with C#" by Tim McCarthy (Wrox Press) might also be of interest.
I'd take a look at CSLA and its sample application, ProjectTracker. Here at work I've done a few projects using CSLA and it really does help your BOs be much more powerful & useful.
While ProjectTracker is not a real-world domain model it does cover a lot of the situations that a real domain model would need to. So if you look at the features offered by BO layers utilizing CSLA you'll get a good idea of what good domain models should look like.
Rob Connery (of MVC Storefront and Weke Road blog) http://blog.wekeroad.com/ has been getting into DDD of late. The MVC Storefront app may be modified to reflect his learnings, or so I believe. Regardless, he has some good material on this topic.
The website http://www.domaindrivendesign.org has a C# sample app.
One thing about DDD; it tends to be tightly coupled (in the positive sense) with the bsuiness for which it is written. As a result, the best examples are probably tied up in IP and unlikely to be available as OS.
The kind of design I tend to see is usually the anaemic domain model.
I wish I could tell you that I had a great recommendation, since I would love to see this question answered with a consensus home-run choice. But as objektivs observed,
... the best examples are probably tied up in IP and unlikely to be available as OS.
However, there's one domain for which we have abundant open-source code: software development tools.
This is a cop-out (I haven't done the legwork either), but if this question fails to produce a solid choice and you want to pursue this yourself, I would recommend starting with some of the more mature tools that many of us already use: NUnit, DotNetNuke, ScrewTurnWiki, NAnt, etc.. They have several distinct advantages, not the least of which is that their domain models will already be (relatively) accessible to you.
I recently come across tutorial on building Forum application with MVC, nHibernate, AutoMapper, and I find source code really good written and structured, with nice examples on using NH/FluentNH in web apps, domain model and repositories/services: http://mattias-jakobsson.net/Item/45/Building%20a%20forum%20application,%20Part%209
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With