On Wed, 30 Dec 2009, Adrian Lienhard wrote:
On Dec 28, 2009, at 12:39 , Igor Stasenko wrote:
2009/12/28 Stéphane Ducasse <[email protected]>:
Package Classes Methods
Traits 59 873
Traits-Kernel 22 343
Traits-Kernel-Traits 17 215
Traits-Composition 7 127
NanoTraits-Kernel 9 190
NanoTraits-Tests 9 122
Haha. This table is nonsense:
- The package "Traits" includes "Traits-Kernel", "Traits-Composition"
etc. so it is counting the same classes and methods twice
The first line in the table is "nonsense" or just gives a brief overview.
- The numbers are from an older implementation of Traits. In Pharo
there is a refactored version with less traits that is easier to
understand. Squeak has an old version.
Well, it's abandoned.
- Methods defined in the traits ("Traits-Kernel-Traits") are also used
by Behavior, ClassDescription, etc. hence making these classes smaller
in turn (but the table does not show this fact)
Correct me if I'm wrong, but PackageInfo >> #methods returns only local
selectors, so this is not true.
- The requires algorithm is not directly related to Traits (as I
pointed out in a recent mail)
That's cool, but why is it there?
In a Pharo 1.0 image I get
Package Classes Methods
Traits-Kernel 11 343
Traits-Kernel-Traits 6 215
Traits-Composition 7 122
[...]
Igor please rephrase your thoughts! :)
amount of complexity !!!
not amount of code!!!
Come on number of classes is not a decent measure in
presence of late binding!
hehe.. i hope that Andreas writing short methods, not a fat ones which
trying to do everything at once :)
Not sure about this. I browsed through the NanoTraits code for 2
minutes, and one thing that puzzled me was this method:
!ClassDescription methodsFor: '*NanoTraits-Extensions' stamp: 'ar
12/20/2009 13:38'!
installTraitsFrom: aTraitComposition
[...]
Picking one long method is easy. Let's see raw numbers:
NanoTraits in Squeak Trunk (update 8660)
Package Classes Methods Loc Loc/Method
Traits-Composition 5 64 221 3.45
Traits-Kernel 22 91 394 4.33
Traits-Kernel-Traits 17 0 0 -
Kernel-Classes 10 589 4754 8.07
Total 54 744 5369 7.22
Traits in Pharo 1.1 (update 11120)
Package Classes Methods Loc Loc/Method
Traits-Composition 7 122 615 5.04
Traits-Kernel 11 343 1988 5.8
Traits-Kernel-Traits 6 214 1360 6.36
Kernel-Classes 10 460 3931 8.55
Total 34 1139 7894 6.93
According to these numbers, Pharo's traits implementation has less
classes, more methods, more code and longer methods (average).
(Code to generate the data:
String streamContents: [ :stream |
#('Traits-Composition' 'Traits-Kernel' 'Traits-Kernel-Traits'
'Kernel-Classes' )
do: [ :packageName |
| package methods linesOfCode |
package := PackageInfo named: packageName.
methods := package methods.
linesOfCode := methods detectSum: [ :each |
each compiledMethod linesOfCode ].
stream nextPutAll: (
'<1S><T><2P><T><3P><T><4P><T><5P><N>'
expandMacrosWithArguments: {
packageName.
package classes size.
methods size.
linesOfCode.
methods
ifEmpty: [ '-' ]
ifNotEmpty: [
linesOfCode / methods size roundTo: 0.01 ] }) ] ])
Levente
Not that it bothers me... Andreas is free to do what he likes in his
Squeak ;)
Cheers,
Adrian
_______________________________________________
Pharo-project mailing list
[email protected]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
_______________________________________________
Pharo-project mailing list
[email protected]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project