3 ms·
> I disagree with this. I think something should be a seperate function only if it is (or likely will be) called from several callsites. I disagree. I split ou
by RHSeeger 7y ago
> I disagree with this. I think something should be a seperate function only if it is (or likely will be) called from several callsites.
I disagree. I split out anything that I can describe/test separately. If I need to take a list and
1. Filter it based on custom logic
2. Sort it based on custom logic
Then I will generally break the filter and sort out into their own functions even if they're not used anywhere else. Each function can have it's own description and tests.
- dagss 7y agoI understand that many prefer this. My point wasn't really so much mine or your preference -- my point was that it is a question of stylistic preference, not about spaghetti vs not. As you simply describe your own stylistic preference I am not sure if you agree with me about that or not? If you actually write a seperate test for the function then you have two callsites and of course it must be a seperate function.