Every webdev team out there is doing the same architectural fuckup : using exactly one database, and coupling everything to that. The Controller points straight at the Service which points straight at the DB. Even the basic units of your logic (User, Payment, Document) do not exist without reference to the (ONE) DB. They're called 'Entities'.

It's a nightmare to test. Every click of a 'unit' test requires the database to stand up, be initialised (check its 'Migrations' have been run, if not actually running them), cleaned up afterward, and maybe a few microseconds of that time will be used for testing your logic.

(I don't know what the equivalent frontend fuckup would be - running every unit test through the browser? digression..)

Architecturally it means you can't change dependencies. Do you want a cache in addition to the DB? Kafka? NoSql? A strangler or sidecar pattern where you live-live migrate from one system to another with no down-time? If you manage your dependencies, these are all do-able ideas. If you don't, they are impossible to do, and then, through the lens of all-classes-belong-to-the-one-true-database, you'll perceive those other ideas as terrible, even though it's actually your architecture which is terrible.

DIP says to guard against these kinds of things. Look inside your TaxService and TaxRule classes - you should not see any direct or indirect dependencies to database code. (Just like you shouldn't see any references to the Browser, the DOM, or Kubernetes.)

No dependencies means you can run all 30-50 unit tests in your TaxServiceTests in about 10 millis, and in parallel with whatever other tests are going on.

----

Now take a step back. Everything I wrote above is just the D in SOLID. (And I didn't even get to 'how to do it'; I only covered 'why' and 'how to check if you did it')

Do you see anyone actually engaging with these concepts? cos I don't.

There is a much lower barrier to entry in saying:

"I saw my teammate try to do SOLID and it was the worst so I always avoid it"

"Bob is a right-wing weirdo!"

"SOLID is dogma and it's bad to be dogmatic so SOLID is bad"

"I like a bit of SOLID but NOT TOO MUCH because I'm a pragmatic person"

If you look at the actual principles, what the hell does that last one mean? You only need to maybe stand up the database a little bit to check your tax logic?