4 ms·
Seemingly unpopular opinion (with a lens of Go programming): Don't mock dependencies. It is brittle. Stub/fake with dependency injection. It is unimportant that
by sethammons 6y ago
Seemingly unpopular opinion (with a lens of Go programming): Don't mock dependencies. It is brittle. Stub/fake with dependency injection. It is unimportant that a function was called N times with arguments foo and bar. What is important is that unit tests validate that units output what they should output (success and error cases) and that integration tests ensure things work together.
- artsyca 6y agoHmm yea I can dig that. Next time it comes up I'll mention sethhammons told me to do it. Actually it's good because if you find yourself stubbing too much you may be hiding complexity in your code.
- artsyca 6y agoBy the way don't take my words in the other reply to heart bro. Nobody has ever worked in a dress up environment but everyone is convinced it's not for them but I've seen it firsthand and it's way better and different. It's like when we emphasize the work over anything it's laying the foundation for toxic behaviours whereas then we emphasize the attitude that goes into the work the whole culture changes. Most people will probably never experience it in their whole lives.. But they'll go to their deaths in uncomfortable outfits, yuck.