On Reuse

Lex Spoon lex at cc.gatech.edu
Wed Jun 30 18:37:28 UTC 1999


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.

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:

	1. The new project will probably need to be modified to fit assumptions in the reusable code.

	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.

	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.


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.


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.

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.

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.


That's all.  Thoughts are welcome.


Lex





More information about the Squeak-dev mailing list