What are class categories for?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

What are class categories for?

Peter Kenny-2
Hi all

This is probably a stupid question, but it relates to something I have only
just noticed, having just tried to file in a package from SqueakMap. In the
Squeak system browser the classes are all grouped by categories, whereas in
Dolphin the equivalent classification is by packages. As far as I can see,
in Dolphin the class category can be defined and redefined, and it appears
as an infromation item in the browser title bar, but I cannot find any other
use for it. Am I missing something? (I have searched for references to
categories in the help files; the only mention of class categories seems to
be how to define them.)

--
Best wishes

Peter Kenny


Reply | Threaded
Open this post in threaded view
|

Re: What are class categories for?

Ian B-2
Peter,

>  As far as I can see,
>in Dolphin the class category can be defined and redefined, and it appears
>as an infromation item in the browser title bar, but I cannot find any other
>use for it. Am I missing something?

Not really.  As you say, they are mostly used for documentation
purposes, although they are occasionally used in other ways.

For example, the method
TextEdit class>>applicableTypeConverterCategories
selects suitable TypeConverter classes using their ClassCategory.

The ImageStripper detects development classes by enumerating the
ClassCategory #Development.

I would guess Class categories were implemented in Dolphin because
they are part of the original Smalltalk-80 (Red Book) UI, but to me
they still have a bit of a "solution looking for a problem" feel to
them :-)
--
Ian

The From address is valid - for the moment


Reply | Threaded
Open this post in threaded view
|

Re: What are class categories for?

Howard Oh
In reply to this post by Peter Kenny-2
Peter Kenny,

For Squeak, categories are like Packages in Dophin Smalltalk. It is
mandatory to choose a category for every class one make.

In Dolphin, it doesn't mean that much. It is just for organizing your
classes. I don't give categories for my classes for most of the cases.
Packaging is more important. I spend time for Packaging balancing,
prerequisits analysis, and spliting packages into VM independemt one
and VM dependent one.

Have a good one
Howard J. Oh


Reply | Threaded
Open this post in threaded view
|

Re: What are class categories for?

Peter Kenny-2
Thanks Ian and Howard for your explanations; it's much clearer now. I raised
the issue because I found a fairly large Squeak 'package' with about 250
classes, which the author had organised into 6 categories. I had put all
these into one Dolphin package, and I just wondered whether it was worth
making them separate packages, and if so whether Dolphin provided any tools
to help in doing it. The answer to the second question is apparently 'no';
as to the first, dunno :-)

Peter


Reply | Threaded
Open this post in threaded view
|

Re: What are class categories for?

Ian B-2
Peter,

>  I had put all
>these into one Dolphin package, and I just wondered whether it was worth
>making them separate packages, and if so whether Dolphin provided any tools
>to help in doing it. The answer to the second question is apparently 'no';

You don't really need a special tool for this, at least not unless you
want to get selective about what goes where.

Use the PackageManager to create the packages you want (XSamples and
XObjects in the example below).

Fix up the Category->Package mapping in the way you want ....

map := LookupTable new.
map
        at: 'Samples' put: 'XSamples';
        at: 'Kernel-Objects' put: 'XObjects'.

... evaluate the following in a workspace ....

map keysAndValuesDo: [:cat :pac |
        package := PackageManager current packageNamed: pac.
        (ClassCategory name: cat) contents do: [:each |
                each owningPackage: package]]

... and save the packages.  

NB When trying to save you may well get the error message complaining
about packages containing circular definitions.  That is when the fun
will start :-)


--
Ian

The From address is valid - for the moment