5 ms·
What the blog completely passes over is that now you'd need to write tests for the DockerRegistryClient... which would be 90% of what he complains about in the
by pierrebai 4y ago
What the blog completely passes over is that now you'd need to write tests for the DockerRegistryClient... which would be 90% of what he complains about in the first version!
I mean sure, if you break down a problem into three layers instead of one, then the top layer testing will be three times cleaner... but you'll write three times as much code and three times as many tests, one for each layer.
The end-result might be better layered code, but it takes time to write, and time to test and, the not-so-little downside of "clean" code layers that is often never discussed and tossed aside, you need to read and understand three layers of code to know what is really going on instead of one.
It is worth it when your layers are getting large and heavy, but for three-lines-of-code thing like this... is it really worth it?
- hynek 4y agoNo, it doesn’t pass over that. It specifically points out that it’s a simplistic example for illustration that probably wouldn’t be worth it. And yet the effects are visible and so are the problems/solutions. I mean what do you want here? 1,000 LoC in a blog post so it feels worth it?