19

Does bounded context span over all application layers (domain, application, presentation & infrastructure) or just domain model? For example should i use the following structure:

<bc 1>
 |_ domain
 |_ application
 |_ presentation
 |_ infrastructure
<bc 2>
 |_ domain
 |_ application
 |_ presentation
 |_ infrastructure

or the following:

domain
 |_ <bc 1>
 |_ <bc 2>
application
presentation
infrastructure
gseric
  • 649
  • 4
  • 11

3 Answers3

12

Both are valid approaches. I tend to favour the first option, because it allows better modularity and quite clear boundaries for high level BC. The second option is the 'standard' way of doing this, it favours let's say a more technical layering, while the first option literally favours a more domain driven layering.

Choose the one you feel more comfortable with.

MikeSW
  • 16,140
  • 3
  • 39
  • 53
2

do as you see fit. Each bounded context will have a different domain and surely a different application layer, but we may imagine a common Infrastructure layer ou presentation layer. It really depends on your architectural choices, and on the application you are trying to build.

If you want a more precise answer, add some material to your question, so that we can get your context and your problematic.

Arthis
  • 2,283
  • 21
  • 32
  • It's about Human resources application which is just a part of bigger system. I plan to divide it into few subparts: recruitment (managing job applicants), employment (managing employee) and evaluation/testing (evaluation of both applicants and employees). I guess these are seperate bounded contexts beacuse a person can have these roles, depending on context: applicant, employee or person under evaluation. – gseric Nov 01 '12 at 13:16
  • you migt use DDD to individualize different bounded contexts. But the need to do DDD in each of them is a different question. Anyway, I would favor your first approach also from my very little experience, because it allows you to change your mind a per bc basis. – Arthis Nov 01 '12 at 16:37
  • Ty Arthis, I accepted Mike's answer just because it arrived first. Both answers were equally helpful. – gseric Nov 06 '12 at 07:40
  • no problem, I am not rushing after points or checked answer.. have a nice day! – Arthis Nov 06 '12 at 08:16
0

I think it is not a question about DDD precisely but about an architecture. What kind of coupling between bounded contexts is acceptable/desirable for you.

If all your bounded contexts will:

  • be developed in one programming language
  • access the same database engine
  • be developed by a relatively small team (up to ~20 people)

then probably you should go with the second approach - each bounded context contains its own domain and application layer and all the bounded contexts share the same infrastructure and application layer.

In other cases, you should considering the microservces/SOA architecture.

Adam Siemion
  • 15,569
  • 7
  • 58
  • 92