November 2018
Intermediate to advanced
346 pages
8h 12m
English
It's common to see a database connection string or URL passed into the business-logic layer for the sole purpose of passing it down to the data layer (the database or HTTP client). Typically, the motivation is to pass the config through the layers so that we can swap out the live config for something friendlier for testing. This sounds good, but it breaks the encapsulation of the data layer. Perhaps more concerning is that if we were to change the data-layer implementation to something else, we would likely have extensive shotgun surgery on our hands. The actual problem here is not the testing, but how we have chosen to swap out the data layer. Using the DIP, we could define our requirements ...
Read now
Unlock full access