I would use that if the domain entity is strictly pure but we have a requirement because of which we need to somehow use a third-party service for dates.
In this case, the entity would take the datetime as an argument. The use case function would call the service, receive the datetime and use it to create the entity.
And it still would fit in the impureim sandwich approach:
gather impure data (datetime)
perform pure operation (create entity)
perform impure side effect (save the entity, for example)
But in simpler cases I would go without extra services if they are just “language feature wrappers” 😃
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Thanks! Glad you liked it ^_^
I would use that if the domain entity is strictly pure but we have a requirement because of which we need to somehow use a third-party service for dates.
In this case, the entity would take the datetime as an argument. The use case function would call the service, receive the datetime and use it to create the entity.
And it still would fit in the impureim sandwich approach:
But in simpler cases I would go without extra services if they are just “language feature wrappers” 😃