Skip to main content
Amounted for the shortcommings pointed out in the comments.
Source Link
DarkTrick
  • 286
  • 3
  • 13

How to handle data-intensive functionality of domain objects in DDDClean Architecture?

I'm going to ask this question using a concrete example. An optimal answer would take into account that this is just an example for the general problem.

I'd like to implement a user management system with a Domain-Driven-DesignClean Architecture approach.

  • My system has users and groups.
  • Group objects contain users.
  • Group objects have a contains_user function.
  • users and groups are part of the same bounded context.
Question

How would I implement the contains_user function in Domain-Driven-DesignClean Architecture? How can I cleanly divide domain code / core and non-domain code / infrastructure?

More abstract:

How can I separate an implementation detail (RDS) from domain code without loosing performance?

My own thoughts
  • Loading all users into the group might be bad performance-wise when there is a large number of users in a group.
  • Performance-wise contains_user would best be implemented directly as DB query inside the function. But that would break DDDClean Architecture.

How to handle data-intensive functionality of domain objects in DDD?

I'm going to ask this question using a concrete example. An optimal answer would take into account that this is just an example for the general problem.

I'd like to implement a user management system with a Domain-Driven-Design approach.

  • My system has users and groups.
  • Group objects contain users.
  • Group objects have a contains_user function.
  • users and groups are part of the same bounded context.
Question

How would I implement the contains_user function in Domain-Driven-Design? How can I cleanly divide domain code / core and non-domain code / infrastructure?

My own thoughts
  • Loading all users into the group might be bad performance-wise when there is a large number of users in a group.
  • Performance-wise contains_user would best be implemented directly as DB query inside the function. But that would break DDD.

How to handle data-intensive functionality of domain objects in Clean Architecture?

I'm going to ask this question using a concrete example. An optimal answer would take into account that this is just an example for the general problem.

I'd like to implement a user management system with a Clean Architecture approach.

  • My system has users and groups.
  • Group objects contain users.
  • Group objects have a contains_user function.
  • users and groups are part of the same bounded context.
Question

How would I implement the contains_user function in Clean Architecture? How can I cleanly divide domain code / core and non-domain code / infrastructure?

More abstract:

How can I separate an implementation detail (RDS) from domain code without loosing performance?

My own thoughts
  • Loading all users into the group might be bad performance-wise when there is a large number of users in a group.
  • Performance-wise contains_user would best be implemented directly as DB query inside the function. But that would break Clean Architecture.
added 82 characters in body
Source Link
DarkTrick
  • 286
  • 3
  • 13

I'm going to ask this question using a concrete example. An optimal answer would take into account that this is just an example for the general problem.

I'd like to implement a user management system with a Domain-Driven-Design approach.

  • My system has users and groups.
  • Group objects contain users.
  • Group objects have a contains_user function.
  • users and groups are part of the same bounded context.
Question

How would I implement the contains_user function in Domain-Driven-Design? How can I cleanly divide domain code / core and non-domain code / infrastructure?

My own thoughts
  • Loading all users into the group might be bad performance-wise when there is a large number of users in a group.
  • Performance-wise contains_user would best be implemented directly as DB query inside the function. But that would break DDD.

I'm going to ask this question using a concrete example. An optimal answer would take into account that this is just an example for the general problem.

I'd like to implement a user management system with a Domain-Driven-Design approach.

  • My system has users and groups.
  • Group objects contain users.
  • Group objects have a contains_user function.
Question

How would I implement the contains_user function in Domain-Driven-Design? How can I cleanly divide domain code and non-domain code?

My own thoughts
  • Loading all users into the group might be bad performance-wise when there is a large number of users in a group.
  • Performance-wise contains_user would best be implemented directly as DB query inside the function. But that would break DDD.

I'm going to ask this question using a concrete example. An optimal answer would take into account that this is just an example for the general problem.

I'd like to implement a user management system with a Domain-Driven-Design approach.

  • My system has users and groups.
  • Group objects contain users.
  • Group objects have a contains_user function.
  • users and groups are part of the same bounded context.
Question

How would I implement the contains_user function in Domain-Driven-Design? How can I cleanly divide domain code / core and non-domain code / infrastructure?

My own thoughts
  • Loading all users into the group might be bad performance-wise when there is a large number of users in a group.
  • Performance-wise contains_user would best be implemented directly as DB query inside the function. But that would break DDD.
Source Link
DarkTrick
  • 286
  • 3
  • 13

How to handle data-intensive functionality of domain objects in DDD?

I'm going to ask this question using a concrete example. An optimal answer would take into account that this is just an example for the general problem.

I'd like to implement a user management system with a Domain-Driven-Design approach.

  • My system has users and groups.
  • Group objects contain users.
  • Group objects have a contains_user function.
Question

How would I implement the contains_user function in Domain-Driven-Design? How can I cleanly divide domain code and non-domain code?

My own thoughts
  • Loading all users into the group might be bad performance-wise when there is a large number of users in a group.
  • Performance-wise contains_user would best be implemented directly as DB query inside the function. But that would break DDD.