Source: matthiasnoback.nl

Violating the Dependency rule
I write about design rules a lot, but I sometimes forget to: The rules should work in most cases, but sometimes need to be "violated".

Whereas in practice it should be more like: Yeah, I know that rule, but it makes more sense to follow that other rule here, because

.

To check if we didn't "violate" the dependency rule, we'd have to iterate over all the classes and look at two things: the namespace of the class and the namespaces of the classes and interfaces that are imported in this class.

In order to do that it should look at each class, figure out what type of class it is, and according to a certain rule set make a judgement.

We want to ensure that the core of our application contains pure functions only, and that it is surrounded by impure functions that facilitate the communication with external actors for us.
Newsletter

Get the latest Laravel/PHP jobs, events and curated articles straight to your inbox, once a week

Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future. Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future.
Community Partners