DEV Community

Discussion on: Domain Driven Design with PHP and Symfony

Collapse
 
noverkill profile image
noverkill • Edited

Can you point me to one or more of your github repo(s) where I could see the above concepts implemented in a full / partial application(s)? A simple demo app would be very useful implemented particularly to showcase above concepts. I think share more actual code examples next to the concepts would have been also useful to clarify things. Without actual real life code examples I think this article is too theoretical and only mostly makes sense to people that already very familiar with the concepts you are explaining. One other thing I do not really get, is what happens to the Service layer in DDD, or that's what's replaced with commands?

Collapse
 
ludofleury profile image
Ludovic Fleury • Edited

thank you very much for your constructive feedback. You are totally right. I'll be trying to iterate on them, I don't know if I would edit or post a second one.

The service layer, It is common to discriminate: application service from domain service. It was confusing me when I started. I was used to SOA with a unique service layer.

Basically: Domain service are usually "pure service", like "pure function". Meaning they externalise complexe cross entity logic but they are usually stateless.

For instance: Shipping cost estimation working with an "order", a "shipping address" and a "shipping method". This could be a good domain service. The good part: domain service are easily unit testable. And we like to have domain logic covered by them.

Application (service) layer: these are the handlers in a command pattern approach, and it saved me from so much headaches trying to organise my code.

To be honest, I'm not even quite sure how I would manage a plain DDD project without the command pattern. I would have to implement application service layer to manipulate the persistence, name them (the hardest part) and their methods. Would probably be really messy.