Call for Action! ...or "The Holy Crusade Against Empty Class Comments"

goran.hultgren at bluefish.se goran.hultgren at bluefish.se
Thu Apr 18 09:03:34 UTC 2002


In another thread we where discussing newbie problems, how to produce
good reference material (both in-image/HTML-form/for books). And frankly
- all these missing class comments really piss me off (pardon my french)
- I am not mad at any individual or group - I am just mad at all of us -
the whole community for not having fixed this! Call it "positive
creative anger". :-)

What I wrote in the other thread:
------
A few simple things we could start with:

1. Add some form of filtering in the Hierarchy browser based on
categories/modules. When a newbie open up a hierarchy to find out which
class to use, say on "Morph" (cough) he/she drowns in morphs. And why?
Because lots of those classes are not in the Morphic categories - it
should be possible to filter out "application classes" like MinesTile
etc.

2. Write these damn class comments. We are all at fault here - christ,
there isn't even a class comment for "Set"! Couldn't someone just write
a snippet that finds all classes (in the base categories/modules)
without comments and place that list on a Swikipage. Then we could just
"sign up" on them, write a good comment (without risking someone else
doing duplicate work) and submit those as "[ENH] Comment for: Xxx". We
(the harvesters) could then fasttrack those since we know it's just a
comment on a class which didn't have one to begin with.
------

Number (1) above is for somebody else - that code is not my hometurf
(Doug?) - I think it would help Newbies (and me too!) A LOT.

So I focused on (2) above, the code belows finds UNCOMMENTED classes in
the most fundamental class categories (please correct my patterns if you
want to add/remove from those).
Do an inspect on this:

| classNames categoryPatterns |
classNames _ OrderedCollection new.
categoryPatterns _ #('Kernel-*' 'Collections-*' 'System-*' '*Kernel*').
categoryPatterns do: [:pat |
	classNames addAll: (Array streamContents:
		[:s | (SystemOrganization categoriesMatching: pat) do:
			[:cat | (SystemOrganization superclassOrder: cat) do: [:c | c
theNonMetaClass organization classComment isEmpty ifTrue:[s nextPut: c
name]]]])].
classNames asSortedCollection

This gives me 115 classnames in 3.2g 4811.

If we start by fixing these (and a fixed comment should be minimal 5
lines IMHO) then we can proceed with all those classes with quite
minimal classcomments (less than 80 characters):

| classNames categoryPatterns |
classNames _ OrderedCollection new.
categoryPatterns _ #('Kernel-*' 'Collections-*' 'System-*' '*Kernel*').
categoryPatterns do: [:pat |
	classNames addAll: (Array streamContents:
		[:s | (SystemOrganization categoriesMatching: pat) do:
			[:cat | (SystemOrganization superclassOrder: cat) do: [:c |
				(c theNonMetaClass organization classComment size between: 1 and:
80)
					ifTrue:[s nextPut: c name]]]])].
classNames asSortedCollection

This gives me another 40 in 3.2g 4811.

Should I whip up some code to produce the tables for the Swiki as my
little plan suggests?

regards, Göran



More information about the Squeak-dev mailing list