Domain Driven Design: Can Infrastructure or Repositories use Domain objects?

Felipe Lavratti

Considering Domain Driven Design, can Infrastructure or System use Domain's objects (Values, Entities, etc.), or should it be applied Dependency Inversion, so that Infrastructure will only depend on Interfaces defined by itself?

What about the Repository? Does it applies de same?

Is it a violation to a Infrastructure, Repository or a System code depends on the Domain?

(A) Example code where Infrastructure depends on the Domain:

namespace Infrastrcuture {
    public class Sender {
        public void Send (Domain.DataValue data) { ... }
    }
}

(B) Example code where Infrastructure will not depend on the Domain:

namespace Infrastrcuture {
    public interface ISendableData {
        ...
    }
    public class Sender {
        public void Send (ISendableData data) { ... }
    }
}
Kenneth

In general, I'd say it's OK if your infrastructure depends on your domain. The other way around is not such a good idea.

Think about it this way: what is more likely to be replaced at some point? Infrastructure or domain?

Infrastructure will change over time (different providers, different servers, ...) Your domain on the other hand will always be there

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Domain Driven Design: Can Infrastructure or Repositories use Domain objects?

From Dev

Domain Driven Design: infrastructure concern or domain concern?

From Dev

Domain Driven Design: infrastructure concern or domain concern?

From Dev

Domain driven design repository implementation in infrastructure layer

From Dev

Domain Driven Design Bounded Context Domain Objects

From Dev

Domain driven design can value objects reference / embed an entity

From Dev

DDD (Domain Driven Design) Can I use inheritance ?

From Dev

Domain-Driven-Design Entities and Value Objects

From Dev

Populating Domain objects with data in a Domain Driven Design architecture

From Dev

Is there a mismatch between Domain-Driven Design repositories and Spring Data ones?

From Dev

Domain Driven Design - where should we put repositories?

From Dev

Is there a mismatch between Domain-Driven Design repositories and Spring Data ones?

From Dev

Domain Driven Design - Domain or Security

From Dev

Layers in Domain Driven Design

From Dev

Access Control in Domain Driven Design

From Dev

Domain Driven Design and batch processing

From Dev

Implementing Domain Driven Design Cost

From Dev

Implementing Domain Driven Design Cost

From Dev

When we shouldn't use Domain-Driven Design approach?

From Dev

Domain Driven Design; Can ValueObject contains invariants or specifications?

From Dev

Domain Driven Design. Entity type design

From Dev

Can Domain Services access Repositories?

From Dev

Implementing Paging and Sorting with Domain Driven Design

From Dev

Implementing Domain-Driven Design and Transactions

From Dev

Domain Driven Design in Node.js Application

From Dev

Fetching associated aggregates in Domain driven Design

From Dev

Domain Driven Design - CQRS + ES usage

From Dev

Where is the call to persistence in the domain driven design

From Dev

Implementing Domain Driven Design Book Confusion

Related Related

  1. 1

    Domain Driven Design: Can Infrastructure or Repositories use Domain objects?

  2. 2

    Domain Driven Design: infrastructure concern or domain concern?

  3. 3

    Domain Driven Design: infrastructure concern or domain concern?

  4. 4

    Domain driven design repository implementation in infrastructure layer

  5. 5

    Domain Driven Design Bounded Context Domain Objects

  6. 6

    Domain driven design can value objects reference / embed an entity

  7. 7

    DDD (Domain Driven Design) Can I use inheritance ?

  8. 8

    Domain-Driven-Design Entities and Value Objects

  9. 9

    Populating Domain objects with data in a Domain Driven Design architecture

  10. 10

    Is there a mismatch between Domain-Driven Design repositories and Spring Data ones?

  11. 11

    Domain Driven Design - where should we put repositories?

  12. 12

    Is there a mismatch between Domain-Driven Design repositories and Spring Data ones?

  13. 13

    Domain Driven Design - Domain or Security

  14. 14

    Layers in Domain Driven Design

  15. 15

    Access Control in Domain Driven Design

  16. 16

    Domain Driven Design and batch processing

  17. 17

    Implementing Domain Driven Design Cost

  18. 18

    Implementing Domain Driven Design Cost

  19. 19

    When we shouldn't use Domain-Driven Design approach?

  20. 20

    Domain Driven Design; Can ValueObject contains invariants or specifications?

  21. 21

    Domain Driven Design. Entity type design

  22. 22

    Can Domain Services access Repositories?

  23. 23

    Implementing Paging and Sorting with Domain Driven Design

  24. 24

    Implementing Domain-Driven Design and Transactions

  25. 25

    Domain Driven Design in Node.js Application

  26. 26

    Fetching associated aggregates in Domain driven Design

  27. 27

    Domain Driven Design - CQRS + ES usage

  28. 28

    Where is the call to persistence in the domain driven design

  29. 29

    Implementing Domain Driven Design Book Confusion

HotTag

Archive