Is Okay to Extend the Domain Services by Application Services while implementing DDD
Hi friends,
I'm implementing a project using various advanced concepts, one of these concepts is
DDD (Domain Driven Design)
.
I have these layers Domain
, Infrastructure
and Application
layers.
In the Domain
layer I have some Domain Services
,
In the Infrastructure
as everyone knows I implemented the Repositories
In the Application
layer I have Application Services
, but here the confusing point for me, beacuse I let the Application Services
to extend the Domain Services
( by the inheritance ).
Example:
Domain Service:
Application Service:
Additional info:
In the Application
layer I have imlemented the CQRS
( Commands and Queries )
Question:
I'm confusing about letting the implementation as I showed you, or do a better approach.
I asked Github Copilot
and it told me that the Application layer
should not directly depend on Repositories
instead it should depend on Domain Services
and the Domain Services
should depend on Repositories
.
Please share with me your experience about this topic.
Massive thanks in advance <310 Replies
question: is DDD/Clean Arch something you decides or is this a class requirement, etc?
It is my decides
watch these videos: $vsa
would encourage not going down the path of DDD/CA/etc.
I already implementing the
VSA
alongside with CQRS
in the Application layer
VSA would encourage removing these "layers". for each endpoint, just have a controller and a handler, and all handlers rely on the dbcontext.
use dumb DTOs and dumb DB Entities. and separate DTOs and DB Entities. forget DDD entirely
https://github.com/viceroypenguin/VsaTemplate/blob/master/Web/Features/Features/Handlers/CreateFeature.cs an example of how i do it
Yeah, that is very very good, I have implemented the
VSA
in another project I found it fine, but in this project I want to continue with DDD
a) why? b) what does DDD mean to you?
better to use these to guide you to an answer than trusting ai. ai doesn't have any intrinsic understanding of what you're doing, why, or what is "right"; it only knows how to regurgitate the next sentence, which may or may not make sense in the context of what you're doing.
I fully agree with you about the AI part, I just want to see how it can answer me
The Current projet I'm working on, I just want to use
DDD
as a challenge