3 ms·
This is back to the usual intractable problem - naming things. If you name the function properly and it abstracts the operation of the function precisely then y
by neilwilson 7y ago
This is back to the usual intractable problem - naming things. If you name the function properly and it abstracts the operation of the function precisely then you have added information, not taken it away.
You understand what 'has_kettle_boiled' means.
Inlining functions makes it difficult in a sequence to work out what are the separate steps. Splitting those out into a function - particularly if they take the temporary variables with them - makes it easier to understand what the higher level function does, not harder.
Perhaps we should revisit stepwise refinement as a technique and the need for functions to be loosely coupled and highly cohesive.
- syn0byte 7y agoWhat was the kettle boiling? How long ago did it start boiling? Is it still boiling? That Sea level boil or high altitude boil? ARRGH! your function name isn't descriptive enough!