3 ms·
Please accept that I made no argument for a-priory abstraction and modularization. Personally, I find any abstraction problematic, where I cannot understand fro
by pintxo 5y ago
Please accept that I made no argument for a-priory abstraction and modularization. Personally, I find any abstraction problematic, where I cannot understand from the import statements of the current code which other code will be executed.
But there are the times where abstractions and modularization can make our lives so much easier. Who would want to dismiss the abstraction of the filesystem and work rather directly on the disc blocks?
All I am advocating here is, that everything is a tradeoff, and we need to weight the costs of mocking some stuff against refactoring the code in a way that we can live without such a mock. And I have personally been at the point where refactoring some code into a separate function made it easier to unit test this specific highly complex functionality.
- cloogshicer 5y agoFair point, thank you. Used in moderation, the technique you explained above can be worthwhile. I just think it is overused, generally, and the costs are rarely considered. Sorry that my above comment was worded a bit harshly.