I'm designing the architecture for a new project and after analyze the requirements for the project. I realize that most of them are domain specific, also the domain is quite complex (multiple abstractions and inheritance families), also the validation rules are domain specific and it is expected to change quite a bit, the domain entities may vary their logic each year and retrocompatibility must be keep.
So i'm thinking that on this context using the PDO pattern (persistence domain object), can be quite useful for us, because we can use a full object oriented design and benefit from the use of polymophism and inheritance, using a skeleton process that mostly dont it is expected to change and the part that mute each year and it is domain specific can be placed on each PDO.
Thinking on that i have the following doubt, ¿It is correct to inject some service inside a PDO?. I am thinking about some common logic that could be isolated in a service and injected inside the PDO's that require it. Or a PDO should be always clean from injections of any kind and this common behaviour should be placed elsewhere.
I'm assuming that this common behaviour it's not specific to a family of objects, neither to all the "leaf" object on the inheritance tree.
Tanks for your answers.
Aucun commentaire:
Enregistrer un commentaire