DEV Community

Discussion on: Clean Architecture on Frontend

Collapse
 
bespoyasov profile image
Alex Bespoyasov

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:

  • 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” 😃