DEV Community

Discussion on: How to implement Clean Architecture with Laravel

Collapse
samnowakowski profile image
Sam Nowakowski

Thank you for your effort and this insight into this type of architecture. In your CreateUserInteractor, the method seems quite long. Doesn't that violate Uncle Bob's Do One Thing rule?

Collapse
bdelespierre profile image
Benjamin Delespierre Author

I don’t believe it does. Taking care of all the steps involved in account creation (in the example I used) can be considered one thing, it’s an account creation.

Plus, CA advocates against UC calling each other; they are vertical “slices” in your application layers and therefore should be isolated to avoid crossing boundaries.

This point in particular seems open to interpretation though and it’s a frequent topic on Stack Overflow.

DDD answers the issue of crossing boundaries with the notion of bouded contexts. You can read more about that on Martin Fowler’s blog.

At the end of the day, I believe you have the right, as an architect, to choose the trade offs that suits you the best 👍

Collapse
phcostabh profile image
Philippe Santana Costa

I'm on board with @bdelespierre here. If you think from the perspective of reasons to change the CreateUserInteractor is not violating SRP at all.

Collapse
phcostabh profile image
Philippe Santana Costa

As you mention the collaboration between interactors, what's your appoach in this cases? How do you share behavior between interactors without having them call each other?

Thread Thread
bdelespierre profile image
Benjamin Delespierre Author

Behavior shared amongst use cases should go into shared services if and only if it's not incidental dupplication.