3 ms·
There's no argument over it Mocks are evil.
by lupire 6y ago
There's no argument over it
Mocks are evil.
- decentusername 6y agoThis is a vast oversimplification of mocks. Mocks themselves aren't evil, they just enable subpar programming. I'd much rather spend 2 minutes making a functional test with a mock than 2 days rewriting a bunch of core functionality in the name of code purity.
- esc_colon_q 6y agoEvil enough that new mocks should be banned by fiat and enforced by code that requires rarely granted permission to override against projects that are 5 years old and already have hundreds of them in place and do not have architectures that support better ways of testing? It might be a nice thing to avoid them, but you're always working with legacy code, and I've literally had "I need to add a button to accept new permissions" blow up into "I need to refactor our entire class structure across 200 files because I'm not allowed to add a new test that follows our old patterns nor commit this code without coverage, and oh yeah, nobody wants to review that CL in one go so I have to figure out how to break it into 20 bite sized changes. There goes my quarter...". That's just dumb, and that type of dumb is very fashionable at Google.