-1

There is a case management application.

New requirements want to add statuses to cases.

The case will go through a series of statuses until completion.

Each case belongs to a case type. There are many case types.

A case with a different case type might go through statuses in a different order. Each case type has its own status order. One status could be shared by two case types (status example: "Ongoing"), but the order is not necessarily the same.

Some statuses will be attended by another actor. Actor as in it could be a department, a manager level staff, or a division. Only the designated actor will be able to edit a particular status. For example, "Requested for documents from Dept2" status will be chosen by Dept1, after which Dept2 will add documents and then change the status to the next one. Some statuses are attended by a manager level staff.

It is a step by step process.

Upon change of each status, relevant staff will be emailed. For each status, the email recipient list could be different.

Upon change of each status, an email with a body specific to that status will be sent.

During some transitions from one status to the next, a new staff must be assigned to the case. Different statuses will be attended to by different assigned staff.

There are also statuses like "On Hold" that after being done would go back to the status that came before it.

How would this be modeled in DDD?

asked May 8 at 14:39
1
  • 1
    Asking how to model something is a pretty big question; probably too big for this community. This would involve a lot of analysis work. Can you edit your question to describe more about what kind of answer you are looking for? Questions usually do better with a narrower focus. Commented May 8 at 15:07

1 Answer 1

2

DDD doesn't specify how to model things, it's about keeping your code in the same "language" as the business.

So here you have

Case
 Status CurrentStatus
 Staff AssignedStaffMember
CaseType
 Status[] StatusOrder
Status
 name

Now you have to figure out how you want to code the rules about what happens when you change the state of a case. You code put them in CaseType or Status (although we already know that there arte states with the same name by different rules, so...). DDD doesn't care as long as you don't end up in a new feature request meeting saying "We can't do that because WorkFlows need to be divisible by the nearest prime number..." or something else that departs from the central idea of having Cases with Statuses you move between and by doing so sends emails or assigns staff.

answered May 8 at 17:56
2
  • If I have an entity called StatusTransitionRule which has properties FromStatus and ToStatus and define all those rules in the database, am I breaking any DDD principles? I guess the rules are business logic. I am doing this because if I tried to code those rules, I would have to write a lot of code and changing them would be difficult. Commented May 9 at 9:43
  • 1
    Yes, Because you might get a new requirement... "for this case type you cant change status on tuesdays" and you would be all "thats hard because StatusTransistionRules cant.. blah blah" Commented May 9 at 13:37

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.