3 ms·
Test Induced Design Damage? (2014)
- theptip 10y agoI'm interested to hear the patterns that users of MVC frameworks like Rails and Django have adopted when "fat models" start to become unwieldy. The video "Decoupling from Rails"[1] that's linked in this article was quite interesting, and argued a complete separation of business logic from the model code, to allow the business logic to be tested (and reused) more easily. I've definitely found fat-model code to be tricky to mock and test at times in Python/Django, as mocking out the ORM is gnarly. But if the business logic operates on proxy objects, then it would be much easier to do so. On the other hand, DHH's retort to this approach also makes some good points regarding the introduction of excess complexity[2]. It's a fair point that architectural decisions should not be motivated by the speed of the UTs. But perhaps there are other benefits to the Hexagonal architecture, as well. [1]: https://www.youtube.com/watch?v=tg5RFeSfBM4 https://www.youtube.com/watch?v=tg5RFeSfBM4 [2]: http://david.heinemeierhansson.com/2014/test-induced-design-damage.html http://david.heinemeierhansson.com/2014/test-induced-design-...