Programming with Tuples (was On Reuse) - still reuse
Terry Raymond
traymond at IDS.NET
Fri Jul 2 19:58:25 UTC 1999
On Thu, 1 Jul 1999 15:20:57 -0400, Mark Guzdial wrote:
>I've been thinking about reuse, and integration, for a few months now from
>the context of maintaining the PWS. It's almost a holiday weekend (for us
>in the U.S.), so perhaps I might waste some bandwidth describing some of
>these ideas. I doubt that the solutions I've been considering are at all
>new, but perhaps someone could kindly point me toward similar thoughts.
>
>A bunch of people on the PWS list are generating some wonderful additions
>to the system. However, these additions often conflict with one another.
>The most common conflict is that two additions modify the same method, but
>one modifies a couple lines at the top (for example), while the other
>modifies a couple of lines at the bottom.
>
>One answer is, "Better factoring." If that one method were several smaller
>methods, then each contributor would only be modifying unit methods. That
>may be, but it seems to me that there is no one factoring that would mean
>that *all* possible enhancements/additions/modifications to the system
>would only touch unitary methods. There's probably a theorem about O-O
>systems that makes this case somewhere.
[stuff deleted]
>There are lots of holes here. For example, how small does that expression
>unit have to be to be useful? Do we end up writing assembly code, for
>example? But again, it's nearly a holiday weekend, so perhaps you'll
>excuse some half-baked discussion.
I don't think it is half-baked. I keep going back and forth on the issue
myself.
>I haven't read much of Bertrand Myer's work, but my guess is that he's
>someone who's probably worked out things like this. Any suggestions?
Kent beck has written that a method should do only one thing and it
should be written at a consistent level of abstraction. I would add
to that, that a class should implement only one functional area.
On the system that I am working some people have highly factored code,
which is easier to reuse. But it is more difficult to understand,
you have to look at a lot of trees to figure out what the forest looks
like.
My current approach is to try to keep method from becoming too factored,
5 - 10 lines seems to be a nice trade-off. Later, if I find I am
doing something else similar in another method then I will refactor it.
Terry Raymond
Crafted Smalltalk
(401) 846-6573 http://www.craftedsmalltalk.com
More information about the Squeak-dev
mailing list
|