Skip to main content
Question Protected by gnat
added 799 characters in body
Source Link
RJB
  • 2.1k
  • 1
  • 16
  • 12

(This example was simplified to be more readable. There are other entitiesThe code is definitely still clunky, and for instancebecause it's a confused attempt, but the AddStatusUpdate has some extradomain behavior -- IRL it actually takes awas: update status category name, and if that category doesn't exist,by adding the category is creatednew status to the archive history. Ultimately I agree with the other answers, this could just be handled by CRUD.)

@AlexeyZimarev gave the correctbest answer, a perfect video on the subject in C# by Jimmy Bogard, but it was apparently moved into a comment below because it didn't give enough information beyond the link. I have a rough draft of my notes summarizing the video in my answer below. Please feel free to comment on the answer with any corrections. The video is an hour long but very worth watching.

Update - 2 Years Later

I think it's a sign of DDD's nascent maturity that even after studying it for 2 years, I still can't promise that I know the "right way" of doing it. Ubiquitous language, aggregate roots, and its approach to behavior-driven design are DDD's valuable contributions to the industry. Persistence ignorance and event sourcing causes confusion, and I think philosophy like that holds it back from wider adoption. But if I had to do this code over again, with what I've learned, I think it would look something like this:

enter image description here

I still welcome any answers to this (very active) post that provide any best-practices code for a valid domain model.

(This example was simplified to be more readable. There are other entities, and for instance the AddStatusUpdate has some extra behavior -- IRL it actually takes a status category name, and if that category doesn't exist, the category is created.)

@AlexeyZimarev gave the correct answer, a perfect video on the subject in C# by Jimmy Bogard, but it was apparently moved into a comment below because it didn't give enough information beyond the link. I have a rough draft of my notes summarizing the video in my answer below. Please feel free to comment on the answer with any corrections. The video is an hour long but very worth watching.

(This example was simplified to be more readable. The code is definitely still clunky, because it's a confused attempt, but the domain behavior was: update status by adding the new status to the archive history. Ultimately I agree with the other answers, this could just be handled by CRUD.)

@AlexeyZimarev gave the best answer, a perfect video on the subject in C# by Jimmy Bogard, but it was apparently moved into a comment below because it didn't give enough information beyond the link. I have a rough draft of my notes summarizing the video in my answer below. Please feel free to comment on the answer with any corrections. The video is an hour long but very worth watching.

Update - 2 Years Later

I think it's a sign of DDD's nascent maturity that even after studying it for 2 years, I still can't promise that I know the "right way" of doing it. Ubiquitous language, aggregate roots, and its approach to behavior-driven design are DDD's valuable contributions to the industry. Persistence ignorance and event sourcing causes confusion, and I think philosophy like that holds it back from wider adoption. But if I had to do this code over again, with what I've learned, I think it would look something like this:

enter image description here

I still welcome any answers to this (very active) post that provide any best-practices code for a valid domain model.

edited body
Source Link
RJB
  • 2.1k
  • 1
  • 16
  • 12

In the battledebate of Rich vs. Anemic domain models, the internet is full of philosophical advice but short on authoritative examples. The objective of this question is to find definitive guidelines and concrete examples of proper Domain-Driven Design models. (Ideally in C#.)

In the battle of Rich vs. Anemic domain models, the internet is full of philosophical advice but short on authoritative examples. The objective of this question is to find definitive guidelines and concrete examples of proper Domain-Driven Design models. (Ideally in C#.)

In the debate of Rich vs. Anemic domain models, the internet is full of philosophical advice but short on authoritative examples. The objective of this question is to find definitive guidelines and concrete examples of proper Domain-Driven Design models. (Ideally in C#.)

added 415 characters in body
Source Link
RJB
  • 2.1k
  • 1
  • 16
  • 12

Update

@AlexeyZimarev gave the correct answer, a perfect video on the subject in C# by Jimmy Bogard, but it was apparently moved into a comment below because it didn't give enough information beyond the link. I have a rough draft of my notes summarizing the video in my answer below. Please feel free to comment on the answer with any corrections. The video is an hour long but very worth watching.

Update

@AlexeyZimarev gave the correct answer, a perfect video on the subject in C# by Jimmy Bogard, but it was apparently moved into a comment below because it didn't give enough information beyond the link. I have a rough draft of my notes summarizing the video in my answer below. Please feel free to comment on the answer with any corrections. The video is an hour long but very worth watching.

added 249 characters in body
Source Link
RJB
  • 2.1k
  • 1
  • 16
  • 12
Loading
Tweeted twitter.com/#!/StackProgrammer/status/387053990745493504
edited tags
Link
RJB
  • 2.1k
  • 1
  • 16
  • 12
Loading
Post Migrated Here from stackoverflow.com (revisions)
Source Link
RJB
  • 2.1k
  • 1
  • 16
  • 12
Loading