Write Explicit Tests

Where I work, we have an in-house Python course that includes a few exercises. I’ve been checking the same exercise solution for a few years now, for every new programmer in our group. It’s interesting to see how a lot of programmers new to Python solve the very same problem. I get to see what each of them does differently and what they all do the same.


This is a companion discussion topic for the original entry at http://amir.rachum.com/blog/2017/01/14/explicit-tests/

Nice article! I agree that DRY principle should be used with caution.
Another article that demonstrate a scenario in which “code duplication” should be prepared:

Kent Beck (you know, the father of TDD) argue about don’t being careful of DRY on testing. http://pythontesting.net/podcast/testing-tdd-kent-beck/

But I think it is important, and responsible to highlight the Testing context. DRY is a fundamental rule, and goal to follow and pursue in Software Engineering.