Classes as Packages (was: Harvesting infrastructure)

Anthony Hannan ajh18 at cornell.edu
Sun Nov 17 20:01:26 UTC 2002


> Anthony Hannan <ajh18 at cornell.edu> wrote:
> > What about classes as packages as per my recent email entitled "Class
> > Dependencies".  I really think we should consider this.

Stephane and Goran,

Thanks for responding.  I was hoping some people would respond so we can
discuss this.  I know my idea is a little radical and requires
significant changes, but I think it is worth considering.  The benefits
might be well worth the changes.  Plus I already have experience and
code for make wholesale changes to the image pretty easily in VI4.

goran.hultgren at bluefish.se wrote:
> Well, I need some time to read your post more carefully - but my initial
> reaction is that I don't really think it will work in practice. It is
> simply too "fine granular". IMHO one of the whole points in talking
> about packages is the fact that we indeed try to group things together
> in bigger more understandable chunks.
> It seems to me that simply saying class == package doesn't solve
> anything.

I understand your thinking.  I was thinking this way as well until I
realized that specifying prerequisites is basically the same as
specifying what belongs in the package.  This lead me to realize that we
don't need packages at all if we just specify prerequisites of the
elements in the package in the first place (the classes and class
extensions).  Then I went further and defined class extensions as
first-class behaviors using multiple inheritance.  I chose multiple
inheritance because it solves another problem as well: better behavior
sharing.  Then I went on to figure how how to find all prerequisites
even in the face of polymorphism.  That is when I decided to assign
selectors to protocols.  This also has a side benefit of better
structured code.  So with these too added features we are able to
reliable find all prerequisites of a class automatically.  This is
basically the process we go through when we defined packages manually.

Stephane Ducasse <ducasse at iam.unibe.ch> wrote:
> I think that classes are not packages. I think that this really 
> important
> not to have classes as packages. Because packages are groups of
> declaration (class def, method def, var def).
> We can unify everything and at the end we got a magna.
> Some programming languages try to unify classes and modules but
> conceptually this is really different and when you teach concepts about 
> OO
> you never have classes as subsystem.
> So I would vote really against it.

A class can be viewed as a group of declarations as well: vars and
methods.  Java defines classes as modules.  Subsystems should be objects
also, that his the whole idea behind object-oriented: everthing is an
object.  So the class of the subsystem object would be it own package
with all other classes that it uses as its prerequisites.

Cheers,
Anthony



More information about the Squeak-dev mailing list