Naturally, every method of a class references its own class as a literal...
Also, class-side methods not accounted for.

Easy enough to change the script to higlight only external references:

d := Dictionary new.
Smalltalk allClasses, (Smalltalk allClasses collect: [:cls | cls class]) do: [ :cls | cls methods do: [:cm | (cm literals select: [:l | l isKindOf: Association ])
 do: [:assoc |
  (assoc value isBehavior and: [assoc value ~~ cls])
ifTrue: [d at: assoc value put: (d at: assoc value ifAbsentPut: [0] ) + 1]]]]. associations := d associations asSortedCollection: [:a1 :a2 | a2 value < a1 value]. associations select: [:ass | ass key comment isNil or: [ass key comment isEmpty or: [ass key comment asString includesSubString: 'xxxxxx']]]

Regards, Gary

----- Original Message ----- From: "Alexandre Bergel" <[email protected]>
To: <[email protected]>
Sent: Tuesday, December 07, 2010 2:53 PM
Subject: Re: [Pharo-project] Comments or no integration: a simple choice foryou


A small script that gives the most referenced classes that are not commented:
I run the test in an image with Moose and Spy.
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
"Get the number of references per class"
d := Dictionary new.
Smalltalk allClasses do: [ :cls | cls methods do: [:cm | (cm literals select: [:l | l isKindOf: Association ])
do: [:assoc |
(assoc value isBehavior)
ifTrue: [d at: assoc value put: (d at: assoc value ifAbsentPut: [0] ) + 1]]]]. associations := d associations asSortedCollection: [:a1 :a2 | a2 value < a1 value].

"Get the classes that are not commented"
associations select: [:ass | ass key comment isNil or: [ass key comment isEmpty or: [ass key comment asString includesSubString: 'xxxxxx']]]
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

The first 30 entries:
SortedCollectionTest->307
HeapTest->304
IntervalTest->250
DictionaryTest->192
BagTest->167
RxMatcherTest->166
PluggableTextMorph->149
MooseModel->144
UIThemeWatery2->132
SystemChangeNotifier->132
PPSmalltalkParserTests->129
FAMIXClassNavigationTest->128
PPJavaSyntax->128
PPSmalltalkGrammarTests->128
RBRefactoryTestDataApp->123
NSFileStream->118
NSRWBinaryOrTextStream->109
LogicalFont->109
NSMultiByteBinaryOrTextStream->108
UIThemeW2K->103
MCWorkingCopy->101
BrowserEnvironment->97
DemoSettingStyle->94
PPJavaLexiconTests->94
MCClassDefinition->93
NSAbstractInflateStream->92
MCWorkingCopyBrowser->91
NSCollectionStreamTest->91
GMMetaObject->91
ExceptionTester->90


Cheers,
Alexandre


On 7 Dec 2010, at 10:48, Stéphane Ducasse wrote:

The good idae is to push and promote people to put class comments, but not to remove not commented classes from Dev, bacause otherise, you will need to remove 80% of the classes.


So this is simple to start fixing some of them.
I think that without such objectives we will never make any progress and we should.

so what are the first 5% of packages that are not documented.

Stef

The next step would be a Pareto classification, as it can be accepted (I hope) that SUnit has more history (and it is documented elsewhere, like PBE book) than other classes which even the name of it or its methods may be insufficient to arrive at for what is the class.

We should create IRC meetings, sprints, etc. specially targeted to document these classes.

my .019999...

--
Cesar Rabak


Em 05/12/2010 20:07, Mariano Martinez Peck < [email protected] > escreveu:

On Sun, Dec 5, 2010 at 9:52 PM, Stéphane Ducasse <[email protected]> wrote:

Hi guys

I decided that I will not integrate any code that is not documented in Pharo.

I strongly suggest to remove from Pharo-dev packages whose classes are not commented.


I think this is not a good idea...look this approx:



| pharoCorePackages packagesDev nonCommentedClasses totalClasses |
pharoCorePackages := #('MultilingualTests' 'Morphic' 'ToolBuilder-Kernel' 'PackageInfo' 'Polymorph-ToolBuilder' 'Network-Kernel' 'Network-Protocols' 'Compiler' 'System-Finalization' 'Settings-Graphics' 'Collections' 'Network-RemoteDirectory' 'Traits' 'Network-URI' 'Settings-Display' 'Collections-Abstract' 'Settings-Compiler' 'MonticelloMocks' 'ScriptLoader11' 'System-Digital Signatures' 'System-Localization' 'MenuRegistration' 'Polymorph-TaskbarIcons' 'Monticello' 'ToolBuilder-Morphic' 'MCDirtyPackage' 'Collections-Weak' 'Settings-Polymorph' 'Tests' 'HelpSystem-Core-Utilities' 'SUnit' 'Collections-Text' 'Compression' 'Morphic-MorphTreeWidget' 'HelpSystem-Core' 'ToolsTest' 'Gofer-Core' 'Gofer-Tests' 'Collections-Stack' 'FreeType' 'MonticelloConfigurations' 'Polymorph-Geometry' 'Collections-Support' 'SUnitGUI' 'HelpSystem-Core-Model' 'Tests-VM' 'System-Change Notification' 'System' 'Tests-ObjectsAsMethods' 'HostMenus' 'Network-MIME' 'Network-RFC822' 'VB-Regex' 'TrueType' 'Depr ecatedPreferences' 'System-Clipboard' 'System-Settings' 'MorphicTests' 'System-Serial Port' 'NetworkTests' 'Collections-Unordered' 'System-Changes' 'System-Object Storage' 'Collections-Traits' 'System-Platforms' 'Tests-PrimCallController' 'Morphic-TrueType' 'Multilingual' 'Graphics' 'Collections-Strings' 'KernelTests' 'System-FileRegistry' 'Tests-Bugs' 'ToolBuilder-SUnit' 'Tests-Release' 'Morphic-Balloon' 'Settings-Network' 'System-Applications' 'Polymorph-Tools-Diff' 'Settings-Tools' 'ScriptLoader' 'ST80' 'FreeTypeSubPixelAntiAliasing' 'Settings-Kernel' 'Settings-System' 'CompilerTests' 'System-Tools' 'System-Hashing' 'System-Download' 'Collections-Streams' 'Tests-SystemChangeNotification' 'GraphicsTests' 'Polymorph-Widgets' 'Kernel' 'Tools' 'Settings-FreeType' 'FreeTypeTests' 'Settings-Monticello' 'HelpSystem-Tests' 'Polymorph-EventEnhancements' 'System-Support' 'MonticelloGUI' 'System-FilePackage' 'System-Object Events' 'Announcements' 'System-Text' 'Exceptions' 'Network- UUID' 'System-Pools' 'FixUnderscores' 'HelpSystem-Core-UI' 'GraphicsResources' 'Files' 'Gofer' 'Network-MailSending' 'Collections-Arrayed' 'CollectionsTests' 'Balloon' 'Network-Url' 'Collections-Sequenceable' ).
packagesDev := (PackageInfo allPackages
collect: [:each | each packageName])
difference: pharoCorePackages.
nonCommentedClasses := packagesDev
inject: 0
into: [:sum :each | sum + (((PackageInfo named: each) classes
select: [:aClass | aClass comment asString includesSubString: 'is xxxxxxxxx.']) size)].
Transcript show: 'nonCommentedClasses: ', nonCommentedClasses asString.

totalClasses := packagesDev inject: 0 into: [:sum :each | sum + (PackageInfo named: each) classes size ].
Transcript show: 'totalClasses: ', totalClasses asString.



Shows:

nonCommentedClasses: 1116
totalClasses: 1369


I'm not sure that I will look at code or answer question to code that is not commented. We should change our mindset and it seems that we do not care, so we should take radical decisions:
less changes, less progress, more comments.

And for once I will not bash the past. Smalltalk was always with methods fully documented.
We are just plain lazy and this is a shame.

Stef









--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.







Reply via email to