E
Ed Kirwan
Patricia Shanahan wrote:
There seems to be a logical conclusion to this which does harbour some
appeal, though I've never tried it myself.
It could be said that a method may contain only one of the following:
i) A set of non-method-calling statements.
ii) A set of method calls.
iii) A single if-then-else statement plus enclosed sets set of method
calls .
iv) A single iteration plus enclosed sets of method calls.
v) A try/catch statement plus enclosed sets of method calls.
There's something pleasantly ... can't-go-lower-ish about it. Like finding
the unsplittable atoms of execution. It even looks a little language-y, and
might lend itself to (a form of meta-) parsing.
It also raises the question of degree. When does a method stand on its own
two feet and when does it shatter into mini-methods? It would be nice to
identify a mathematically describable property whereby we could chart an
entire-class-in-a-method at one end, and an even more rigid method split
than that defined above (say, rewriting (i) to allow a method to hold a
maximum one non-method-calling statement). It would be nice to find where
such a property's differential would hit 0.
There is a school of programming that holds that a feeling that a block
of code within a method needs a comment is a warning that it should have
been a separate method.
....
Patricia
There seems to be a logical conclusion to this which does harbour some
appeal, though I've never tried it myself.
It could be said that a method may contain only one of the following:
i) A set of non-method-calling statements.
ii) A set of method calls.
iii) A single if-then-else statement plus enclosed sets set of method
calls .
iv) A single iteration plus enclosed sets of method calls.
v) A try/catch statement plus enclosed sets of method calls.
There's something pleasantly ... can't-go-lower-ish about it. Like finding
the unsplittable atoms of execution. It even looks a little language-y, and
might lend itself to (a form of meta-) parsing.
It also raises the question of degree. When does a method stand on its own
two feet and when does it shatter into mini-methods? It would be nice to
identify a mathematically describable property whereby we could chart an
entire-class-in-a-method at one end, and an even more rigid method split
than that defined above (say, rewriting (i) to allow a method to hold a
maximum one non-method-calling statement). It would be nice to find where
such a property's differential would hit 0.