visibility" of class object in favour of a global context

Avi Bryant avi at beta4.com
Sat May 24 18:28:58 UTC 2003


On Sat, 24 May 2003, Andreas Raab wrote:

> If we would have a way to increase the 'locality' of these methods, I think
> we could solve many problems at the same time. 'Pollution' of class Object
> would no longer be a problem as the methods added to it might not even be
> visible there. Understanding the system would be simpler as one can observe
> the context in which a method is defined (if #isFoo were close to Foo and
> Bar I could guess that it must be related to the two and see what they do).
> Modularization and dependency tracking would be improved as well since it
> were much less likely that I'd be using #isFoo if I haven't looked at the
> place where Foo and Bar are defined.

Are you sure this can't just be solved by improving the tools?
If the Browser showed Object>>isFoo to be in the same category as Foo and
Bar, would it bother people as much that it was on Object?

For fun, I'm attaching PackageInfoBrowser, a PackagePaneBrowser I just now
extended to be somewhat PackageInfo/DVS aware - when you have a package
selected, it adds an *Extensions category to the second pane, which
contains any classes that have been given class extensions for this
package (via the *packagename convention), and shows just these extension
methods in the message list (for some reason I can't get it to do the
right thing with the message category list, but you can get the idea).
-------------- next part --------------
'From Squeak3.4gamma of ''7 January 2003'' [latest update: #5169] on 24 May 2003 at 11:31:41 am'!
PackagePaneBrowser subclass: #PackageInfoBrowser
	instanceVariableNames: 'extensionMethods '
	classVariableNames: ''
	poolDictionaries: ''
	category: 'PackageInfo'!

!PackageInfoBrowser methodsFor: 'as yet unclassified' stamp: 'ab 5/24/2003 11:02'!
classList
	^systemCategoryListIndex = 0
		ifTrue: [
			self systemCategoryList isEmpty
				ifTrue: [systemOrganizer listAtCategoryNumber: (systemOrganizer categories indexOf: self package asSymbol)]
				ifFalse: [Array new]]
		ifFalse: [
			systemCategoryListIndex = 1
				ifTrue: [self extensionClasses]
				ifFalse: [systemOrganizer listAtCategoryNumber:
							(systemOrganizer categories indexOf: self selectedSystemCategoryName asSymbol)]]! !

!PackageInfoBrowser methodsFor: 'as yet unclassified' stamp: 'ab 5/24/2003 11:13'!
extensionClasses
	^ extensionMethods keys asSortedCollection! !

!PackageInfoBrowser methodsFor: 'as yet unclassified' stamp: 'ab 5/24/2003 11:26'!
messageCategoryList 
	^ systemCategoryListIndex = 1
		ifFalse: [super messageCategoryList]
		ifTrue: [Array with: ('*', self package asLowercase)]! !

!PackageInfoBrowser methodsFor: 'as yet unclassified' stamp: 'ab 5/24/2003 11:27'!
messageList
	^ systemCategoryListIndex = 1
		ifFalse: [super messageList]
		ifTrue: [
			classListIndex = 0 ifTrue: [^ #()].
			((extensionMethods at: self selectedClassName ifAbsent: [^ #()])
					collect: [:ea | ea methodSymbol]) asSortedCollection]! !

!PackageInfoBrowser methodsFor: 'as yet unclassified' stamp: 'ab 5/24/2003 11:03'!
packageInfo
	^ PackageInfo named: self package! !

!PackageInfoBrowser methodsFor: 'as yet unclassified' stamp: 'ab 5/24/2003 11:23'!
systemCategoryList
	^  packageListIndex = 0
			ifTrue: [super systemCategoryList]
			ifFalse: [#('*Extensions'), super systemCategoryList]! !

!PackageInfoBrowser methodsFor: 'as yet unclassified' stamp: 'ab 5/24/2003 11:10'!
systemCategoryListIndex: aNumber
	aNumber = 1 ifTrue: [self updateExtensionMethods].
	super systemCategoryListIndex: aNumber
! !

!PackageInfoBrowser methodsFor: 'as yet unclassified' stamp: 'ab 5/24/2003 11:12'!
updateExtensionMethods
	extensionMethods _ self packageInfo extensionMethods groupBy: [:ea | ea classSymbol] having: [:ea | true]! !


More information about the Squeak-dev mailing list