How to identify domain in ddd?

Viewed 266

I want to build an application and I want to apply ddd rules to my architectural design.

I describe my application:

In the database I have tables: report, notification, user, event, company, stakeholder, transaction.

The application will need authentication so I do it against user table.

In the application I need to display and make a crud operation on the tables in the database I was mention above.

And each of them have it's own page in my application. for example:

 /reports (create, delete, get one, get all, search, edit)
 /reports/:id 
 /notifications (create, delete, get one, get all, search, edit)
 /notifications/:id 
 /events (create, delete, get one, get all, search, edit)
 ...

In the report table I have: id, title, lastUpdate, body, company, event. Each report have a list of companies and list of events. the user can edit the report and change the title and the body and he can also add/remove company from the list so goes to event.

const reports = [
{ id, title, body, companies: [{ id, name, ... }], events: [{ id, ...}]}
]

I also want to have separate pages for: company, event, stakeholder to display list of them (company has own page, event has own page..) in order to add/edit/delete each entity.

The transaction items should belong to stakeholder. I mean each stakeholder have many transactions. and same goes here: i want to add/edit/delete each transaction.

 stakeholders = [{ id, name, transactions: [{ id, ... }]}, ...]

** each operation add/edit/delete/view lives in it own page.

--

So I decide to named the domains in my application: auth, report, notification, events, companies, stakeholder, stakeholder-transactions.

And this is lead me to create domains with features following this folder structure:

 reports
  domain (the bl is here)
  feature-edit (use the domain)
  feature-view (use the domain)
  feature-list (use the domain)
  feature-search (use the domain)
 auth
  domain (the bl is here)
  feature-login (use the domain)
  feature-register (use the domain)
  feature-forgot-password (use the domain)
 notification:
  domain (the bl is here)
  feature-create-new (use the domain)
  feature-remove (use the domain)
  feature-edit (use the domain)
  feature-list (use the domain)
 company:
  domain (the bl is here)
  feature-create (use the domain)
  feature-edit (use the domain)
  feature-list (use the domain)
  feature-view (use the domain)
  feature-search (use the domain)
 event:
  domain (the bl is here)
  feature-create (use the domain)
  feature-edit (use the domain)
  feature-list (use the domain)
  feature-view (use the domain)
  feature-search (use the domain)
 stakeholder:
  domain (the bl is here)
  feature-create (use the domain)
  feature-edit (use the domain)
  feature-list (use the domain)
  feature-view (use the domain)
  feature-search (use the domain)
 stakeholder-transaction:
  domain (the bl is here)
  feature-create (use the domain)
  feature-edit (use the domain)
  feature-list (use the domain)
  feature-view (use the domain)
  feature-search (use the domain)

I'm thinking about the area of responsibility of each parts of my application. but does it match the ddd domain requirements? the separation of those folder are matching the ddd domain requirements? because something is not end up, the domain should be isolated. but sometimes I'll need notification to create from the report and report is have a company and event inside.

I really appreciated the help in trying to resolve this conflict

2 Answers

They are not "domains" but modules, and they seems ok.

You describe your application starting with "In the database I have tables:" and "In the application I need to display and make a crud operation on the tables in the database"

So seems to be database/tables centric, a CRUD application, DDD seems overkill for this.

To check the DDD modules/bounded context you should start looking at your domain for what it is, not for the tables you need.

in a very simple sentence I can say domain: is problem space and it comes from a domain expert. in fact, it's about why this software is created and what core problems this software will address. also, DDD is rooted in a language not taking care about which kinda databases you have.

Related