On Reuse

Rik Fischer Smoody riks at smOO.com
Wed Jun 30 21:16:33 UTC 1999


Reuse requires a state of mind AND a lot of work.
It does not happen automatically.
On that, we agree.

I think it is worth the effort.

At 6:37 PM -0700 99/6/30, Lex Spoon wrote:
>A comment to the list.
>
>I find it quite frustrating when I post something to the list, and get replies back saying I should have used this or that bit of code someone else had already posted.  It's especially frustrating when it's just a few thousand lines of code or less, which can be regenerated in a few hours or maybe one day.
Generate one more one-day hack which nobody else will reuse either...
where's the profit in that?
Spend more time looking for existing solutions.
Try to get them fixed if necessary.

>
>The fact is, trying to reuse code, even moderately small amounts of code, is not all that easy.  You can't always just drop in someone's foo and expect it to work.  There are hidden costs in reusing code:

And there are obvious costs in not reusing.

>
>	1. The new project will probably need to be modified to fit assumptions in the reusable code.
Yes, it might.
If the new project were implemented with existing objects in mind (and in image)
this could be a benefit.
(Do you call it modifying a kid's driving behavior when you teach them to drive on
the right side of the road?  That's just the way it's done around here.)
>
>	2. If the code hasn't been reused much before, it's probably going to need modifications for the new project.  So the new author will likely make changes to the original code, and end up having to negotiate those changes with the original author.  If the new author ends up making a new fork of the "reusable" code, then the value from reuse has largely been lost.
So be one of the people who helps MAKE it reusable by making a more adaptable version
which we could then agree subsumes the original.
>
>	3. People have to become aware of appropriate code to reuse.  That's tough, and it takes time.  The UIUC repository could help us if more people used it, but even there, you have to figure out what keywords to put in.  Point is, even if you have somehting perfectly reusable, don't be surprised that a particlar person hasn't heard of it or didn't think of it.
That's why the mail...

Even if the repository works wonderfully, you still need to get in the habit of
looking.  And sometimes you have to guess the words to search.
It reminds me of teaching a class of tyros: they do not know the word "OrderedCollection".
They've been coding C or FORTRAN and they know Array and indexing.
Will they automatically discover a better way? Not if they spend all their time
coding a few thousand lines of fresh FORTRAN-in-Smalltalk-syntax.

And even if they do look, they can miss it.  That's why other people clue them in.
While it's fresh in your mind, cook the problem.
It will never be fresher in anyone's mind than in yours right now.
REDUCE the bulk of code.
Result: a more-reusable library, and a more exemplary client app.
>
>
>To say it again: just because you have an X, doesn't mean that someone else can just pick it up and start using it.  It takes significant effort, and oftentimes it is easier to code another X from scratch.
Now all of the rest of us see two substantially incomparable things...
noise, bulk.
It's REALLY hard to remove those forks.

>
>
>So, whenever you are tempted to make a post implying insta-reuse of something, please consider making one of the other kinds of posts described below.
>
>First, if you have some code that you think will help someone else's project, tell them about it and be sure to explain how you think it will help.  Don't just say "you should have used my foo", period.
Certainly a diplomatic approach.
We sometimes see this sort of mail in response to someone describing what they
want to do BEFORE they did it.
>
>Second, if you are trying to build a sort of library that can be easily reused, don't fool yourself that it is going to be trivial.  It takes significant work to build easily-reusable libraries, and it's unfair to just expect others to do a lot of that work for you.  Even once you have identified a system that someone posted about could make use of your library (or whatever it is), there is work remaining to look at the library and the system and to figure out how to make reuse happen.  Don't just assume they could just trivially drop your library; either really look closely, or be appropriately tentative in your proposal--less tentative according to how closely you have looked.

Sure it's work.
And it's understandable if you have to change more stuff in a newly issued library
than in an old workhorse.
As a user, you do not HAVE to blow a lot of time on the library.
Hack what you need, and tell the originator what you did.
Maybe they'll issue a new version which meets your needs too.
Stand on their shoulders...
>
>Finally, if you have some code for a project which is very similar to something that just got posted, you could post about your project and explain how your version differs.  There will probably be interesting differences between them, if only you take the time to look for them.
I'd expect that burden to be born by the SECOND poster...
explain why the original was not adequate
and why a whole new approach was apropos.
>
>
>That's all.  Thoughts are welcome.
In hard sciences, principal investigsators are expected to keep abreast of what other
researchers are doing... they just do not get published with work that is already in the literature (except for short mention that an experiment was repeatable).
Shall we info-workers do worse?
>
>
>Lex


Rik Fischer SmOOdy     riks at smoo.com
	smOOdynamics    -     Systems Made Outa Objects
		503-249-8300 ph/fx
	2400 NE 25th, Suite 800
	Portland, OR 97212
---
Don't worry that people will steal your ideas. . .
Good ideas have to be crammed down peoples' throats. . .
and even then, they might not sink in.





More information about the Squeak-dev mailing list