3 ms·
I don't like either. My decision about refactoring has to do with the mixing of different levels perspectives. So the different perspectives are "Conceptual,
by keithnz 8y ago
I don't like either. My decision about refactoring has to do with the mixing of different levels perspectives. So the different perspectives are "Conceptual, Specification, and Implementation". Most long functions are because those perspectives are getting jumbled together. I'd argue this approach to looking at your code is much more mentally clearer than the authors advice. With that in mind you can easily refactor things using any number of techniques to separate out each perspective fragment. The book "Working effectively with legacy code" has lot of techniques that are useful (some of which I contributed!). This article is like a highly abridged form of that book ( which is referenced at the end of the article).
- joshuamorton 8y agoThe second example is exactly what your describe. A high level function forms the conceptual idea, it contains many functions that are specify that concept, and within each are implementations. If each function does one thing, it composes other functions, you're forced to follow this type of design.