3 ms·
This is one of the biggest reasons for code becoming unmaintainable. Many people got mad at DHH for speaking ill of TDD, but he is not alone in pointing fingers
by mosselman 9y ago
This is one of the biggest reasons for code becoming unmaintainable. Many people got mad at DHH for speaking ill of TDD, but he is not alone in pointing fingers at blindly restructuring code for the sake of (unit) testing as mentioned in the article.
I get why people would like to pretend that everything is made up of beautiful uncomplicated small pieces, but that is not how life works. At some point you have to understand your tax returns, mortgage contracts and communications with incoherent external APIs. Making me jump to section 4.1.2 and from there to section 7.2 in order to understand the parties mentioned under 1.1a are subject to the rules set out in Appendix A section 42.1 does not make the contract easier to understand. So why would code that feels like a legal document be easier to understand?
- discreteevent 9y agoThat's a really good example of the problems of indirection. I'll use it in future if that's ok. The thing that drives me mad about the promoters of decoupling is that they rarely talk about the downsides. The truth is that every time you decouple something there is a cost in complexity. One individual step to decouple something may seem small but the cumulative effect of many indirections in code can make it extremely difficult to navigate and understand. So when people decouple something they should understand this and make sure that the benefit outweighs the cost (which of course it does in some cases). The benefit of being able to test your code at a micro level rarely outweighs the cost.
- mosselman 9y agoThank you, yes please do. You nicely explained what I feel about this 'advice' when it is formulated compulsively like in the article. You made me think 'yes, exactly that' with regards to some people who seem to ignore the downsides of decoupling. Thank you for that, I'll refer to your comment in the future. Nice to come together like that.