r/node • u/fagnerbrack • Nov 15 '17
Mocking is a Code Smell
https://medium.com/javascript-scene/mocking-is-a-code-smell-944a70c90a6a
14
Upvotes
2
Nov 15 '17
I read this a while ago, it's a really good article and I endorse its message.
It's Javascript specific, but the main thrust of the article and the solutions apply equally well to C# (probably other languages, JS and C# are my people).
10
u/SomeRandomBuddy Nov 15 '17
This article is such a crock of shit. You can definitely use mocks without creating "tight coupling" so long as, as author says, the mocked objects also follow the SRP. This guy is basically waging war on imperative programming. Just because JavaScript contains elements of FP, it isn't a purely functional language.
In short, you can follow best practices and use mocks/inheritance simultaneously and his reasons for not doing it are strictly to avoid using mocks. Which isn't sound.
LMAO
This guy must have just learned about functional react and decided he wanted some attention. I can't even with this.