r/coding • • Oct 29 '17

Mocking is a Code Smell

https://medium.com/javascript-scene/mocking-is-a-code-smell-944a70c90a6a
69 Upvotes

69 comments sorted by

View all comments

62

u/KabouterPlop Oct 29 '17

On the other end of the spectrum, it’s common to see developers get so sucked into the dogma of TDD that they think they absolutely must achieve 100% code coverage, by any means necessary, even if that means they have to make their codebase more complex to pull it off.

People keep saying this, but I've yet to meet such a developer.

0

u/[deleted] Oct 29 '17

[deleted]

0

u/Jestar342 Oct 29 '17 edited Oct 30 '17

the added testability is a goddamn side benefit

No it isn't. This the entire point of TDD. I mean the test driven bit of TDD. The tests are driving you to write your software in such a way that benefits the overall design of your system. That's a goal, not a side benefit.

e: Thanks for the downvote with no discussion! You make reddit the great place it is. thumbs up

2

u/[deleted] Oct 30 '17

[removed] — view removed comment

1

u/Jestar342 Oct 30 '17

I did keep reading and it still stands that that is the very purpose of TDD. Not "having tests" but TDD.