What are some good open source c# examples of quality domain models [closed]
Asked Answered
A

12

36

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.

Edit

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.

Aurelie answered 30/6, 2009 at 15:14 Comment(2)
I just sat down to ask the exact same question, too bad nobody has answered. Have you found anything on your own?Clareclarence
I really haven't done my due diligence yet, but there is so much out there, that I'm afraid I will look for a very long time before I find what I am looking for.Aurelie
I
11

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 :(

Indigestion answered 19/8, 2009 at 18:54 Comment(2)
Forgot to mention the free book at infoq.com/minibooks/domain-driven-design-quickly . It's a short version of Eric Evans book.Indigestion
After looking through Oxite, I think I agree with this article notsotrivial.net/blog/post/2009/01/07/Oxite-A-Deeper-Look.aspxClareclarence
P
4

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.

Patsypatt answered 20/8, 2009 at 14:26 Comment(0)
B
4

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!

Boulogne answered 25/8, 2009 at 6:23 Comment(0)
C
2

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.

Cacka answered 30/6, 2009 at 16:13 Comment(1)
Thanks, I have read Martin Fowler's Patterns of Enterprise Application Development, which has really set me on the right path. I'll have to check out Mr. McCarthy's offering.Aurelie
P
1

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.

Paez answered 19/8, 2009 at 15:19 Comment(2)
We used CSLA in one of our major projects and we still call it the spawn of Satan. It, or at least our implementation, breaks the Open-Close principle. There are also a HUGE amount of issues with the implementation. Fortunately it was not my choice, and I will never use it again.Smallscale
I agree. It is the spawn of Satan. More accurately, it was an excellent pedagogical device that Rocky used to write a good book for OO beginners. Since it was pedagogical, it did not go far enough with refactoring and further needed design improvements (if it had gone that far, it would have lost its pedagogical value for beginners). Then, it was taken and pitched as a fully complete, ready-for-enterprise framework (which is ludicrous), and many business were duped into believing that pitch. Even developers were duped into it because of the religious fervor and guru-status behind it.Tyronetyrosinase
D
1

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.

Dipetalous answered 24/8, 2009 at 5:29 Comment(0)
B
1

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.

Burnell answered 24/8, 2009 at 20:0 Comment(0)
F
1

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

Fiftieth answered 26/8, 2009 at 11:29 Comment(0)
T
0

Have you considered reviwing the Castle Project?

From the Castle Project "Castle is an open source project for .net that aspires to simplify the development of enterprise and web applications. Offering a set of tools (working together or independently) and integration with others open source projects, Castle helps you get more done with less code and in less time."

Tolerate answered 20/8, 2009 at 9:42 Comment(0)
Z
0

I would take a look at the dofactory GoF site. They have a bunch of examples that you can purchase for a pretty small price including:
* MVC -- ASP.NET Web Application
* MVP -- Windows Forms Application
* MVVM -- WPF Appication
It also includes two very good books: "Enterprise Design Patterns" and "Head First Design Patterns"

Zeal answered 20/8, 2009 at 17:31 Comment(2)
I own and have read both of those books, and treasure both of them. Is the package really worth the money? What specific benefits did you get from it that you could not get from the bundled literature and its companion resources?Aurelie
With out a doubt its worth it. You get the complete source code for aspt.net, windows form applications and UML models for each piece of the project. They are great building blocks for whatever you want to build with excellent use of design patterns.Zeal
P
0

I'm currently working on a project using StuctureMap, Fluent NHibernate, Asp.net MVC, AutoMapper, Castle, and xVal frameworks. I've been getting help from the sample projects Nerd Dinner and Code Camp Server. Please let me know if you have questions about any of these frameworks.

http://code.google.com/p/codecampserver/

http://nerddinner.codeplex.com/

Punishment answered 26/8, 2009 at 14:5 Comment(0)
L
0

Take a look at my complete Visual Studio solution on GitHub that you can use as a jump start because it includes a very simple but layered architecture.

I've published detailed videos on object persistence on my blog at http://thomasjaeger.wordpress.com where I go into the reasons of the why and how of a centralized domain model in the solution.

Lilliamlillian answered 4/1, 2015 at 1:31 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.