3 ms·
>>> If you have to spend effort into looking at a fragment of code to figure out what it’s doing, then you should extract it into a function and name the functi
by hbt 9y ago
>>> If you have to spend effort into looking at a fragment of code to figure out what it’s doing, then you should extract it into a function and name the function after that “what”.
Fowler is right about smaller functions and OP misinterpreted his statement.
This is what Fowler means https://gist.github.com/hbt/3e71146454a2d6388338af1d76394a13 https://gist.github.com/hbt/3e71146454a2d6388338af1d76394a13
Abstract the fragment of code in a function, keep it within the function until you need it elsewhere and do not pollute needlessly the API with functions that are poorly named and used one time only.