3 ms·
It's not about runtime performance. It's about how well you can actually assess your code by matching small and well-defined inputs to small and well-defined ou
by closeparen 7y ago
It's not about runtime performance. It's about how well you can actually assess your code by matching small and well-defined inputs to small and well-defined outputs.
LeetCode / CS101 problems are almost always like that. In the real world, it's also useful to separate out any tricky "policy" logic into nicely testable pure functions. But you are still going to have a bunch of side-effect munging left over, and unit testing is terrible at that. Tests that only assess their own mocks are a waste of time.
- cjfd 7y agoCould you give an example of situations where there would not be small and well-defined inputs and outputs because this certainly does not sound like a common situation to me? And what do you mean by 'Tests that only asses their own mocks are a waste of time.' Certainly, many side effects can very effecitively be checked by mocks. Now, it could certainly get much more difficult if the side effects were very large and hard to define as you said in the paragraph before that, but I have some difficulty picturing that as a common situation.