Re: [Pharo-users] SLOC in Smalltalk

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

Re: [Pharo-users] SLOC in Smalltalk

hernanmd
Hi Janko. Thanks for your useful package.

Apparently there is some issue with #linesOfCode. The dummy expression
below return 5 instead of 4 in Pharo 1.4 and 2 because is counting the
autogenerated 'DoIt' selector.

(UndefinedObject evaluatorClass new
        compileNoPattern: '| oc |
oc := OrderedCollection new: 20.
oc add: 1.
oc size'
        in: UndefinedObject
        context: nil
        notifying: nil
        ifFail: []) generate linesOfCode

Hernán

El 31/03/2013 10:17, Janko Mivšek escribió:

> Hi Hernán
>
> I once did some code statistics for our web frameworks, by counting:
>
>    - Nr of packages, categories, classes, methods
>    - lines of code
>    - Avg methods/class
>    - Avg lines/method
>
>    - Nr of test methods
>    - Avg tests/class
>
>    - % of commented methods
>    - % of commented classes
>
> Then three graphs were drawn:
>
>    - Methods in classes
>    - Class inheritance depth
>    - Lines in methods
>
> Results can be seen here:
>
> https://docs.google.com/spreadsheet/ccc?key=0Atnb1W9vuq9ndG4wbUpxNXpKQnFZRlFyQXpHclhZa2c#gid=1
>
> The code measuring all above is here:
>
>     http://www.squeaksource.com/WebCodeStats.html
>
>
> Hope this helps
> Janko
>
>
> Dne 31. 03. 2013 09:23, piše Hernán Morales Durand:
>> Hi there,
>> Guys, what are you using to measure logical lines of code (LOC) in Pharo?
>> Given I am measuring a script, is there any other software measure you
>> may recommend?
>> Cheers,
>>
>> Hernán
>>
>


Reply | Threaded
Open this post in threaded view
|

Re: [Pharo-users] SLOC in Smalltalk

Janko Mivšek
Hernán,

It would be nice if you patch the WebCodeStats by yourself. I just set a
read-write access to the http://www.squeaksource.com/WebCodeStats.html.

Best regards
Janko

Dne 02. 04. 2013 04:54, piše Hernán Morales Durand:

> Hi Janko. Thanks for your useful package.
>
> Apparently there is some issue with #linesOfCode. The dummy expression
> below return 5 instead of 4 in Pharo 1.4 and 2 because is counting the
> autogenerated 'DoIt' selector.
>
> (UndefinedObject evaluatorClass new
>     compileNoPattern: '| oc |
> oc := OrderedCollection new: 20.
> oc add: 1.
> oc size'
>     in: UndefinedObject
>     context: nil
>     notifying: nil
>     ifFail: []) generate linesOfCode
>
> Hernán
>
> El 31/03/2013 10:17, Janko Mivšek escribió:
>> Hi Hernán
>>
>> I once did some code statistics for our web frameworks, by counting:
>>
>>    - Nr of packages, categories, classes, methods
>>    - lines of code
>>    - Avg methods/class
>>    - Avg lines/method
>>
>>    - Nr of test methods
>>    - Avg tests/class
>>
>>    - % of commented methods
>>    - % of commented classes
>>
>> Then three graphs were drawn:
>>
>>    - Methods in classes
>>    - Class inheritance depth
>>    - Lines in methods
>>
>> Results can be seen here:
>>
>> https://docs.google.com/spreadsheet/ccc?key=0Atnb1W9vuq9ndG4wbUpxNXpKQnFZRlFyQXpHclhZa2c#gid=1
>>
>>
>> The code measuring all above is here:
>>
>>     http://www.squeaksource.com/WebCodeStats.html
>>
>>
>> Hope this helps
>> Janko
>>
>>
>> Dne 31. 03. 2013 09:23, piše Hernán Morales Durand:
>>> Hi there,
>>> Guys, what are you using to measure logical lines of code (LOC) in
>>> Pharo?
>>> Given I am measuring a script, is there any other software measure you
>>> may recommend?
>>> Cheers,
>>>
>>> Hernán
>>>
>>
>
>
>

--
Janko Mivšek
Aida/Web
Smalltalk Web Application Server
http://www.aidaweb.si

Reply | Threaded
Open this post in threaded view
|

Re: [Pharo-users] SLOC in Smalltalk

hernanmd
Janko,
As far as I can see the CompiledMethod>>linesOfCode belongs to
Kernel-System of Pharo. I think it would be better to have it patched in
the system if people agrees. Maybe can I have access to report a bug/issue?
Cheers,

Hernán

El 02/04/2013 4:52, Janko Mivšek escribió:

> Hernán,
>
> It would be nice if you patch the WebCodeStats by yourself. I just set a
> read-write access to the http://www.squeaksource.com/WebCodeStats.html.
>
> Best regards
> Janko
>
> Dne 02. 04. 2013 04:54, piše Hernán Morales Durand:
>> Hi Janko. Thanks for your useful package.
>>
>> Apparently there is some issue with #linesOfCode. The dummy expression
>> below return 5 instead of 4 in Pharo 1.4 and 2 because is counting the
>> autogenerated 'DoIt' selector.
>>
>> (UndefinedObject evaluatorClass new
>>      compileNoPattern: '| oc |
>> oc := OrderedCollection new: 20.
>> oc add: 1.
>> oc size'
>>      in: UndefinedObject
>>      context: nil
>>      notifying: nil
>>      ifFail: []) generate linesOfCode
>>
>> Hernán
>>
>> El 31/03/2013 10:17, Janko Mivšek escribió:
>>> Hi Hernán
>>>
>>> I once did some code statistics for our web frameworks, by counting:
>>>
>>>     - Nr of packages, categories, classes, methods
>>>     - lines of code
>>>     - Avg methods/class
>>>     - Avg lines/method
>>>
>>>     - Nr of test methods
>>>     - Avg tests/class
>>>
>>>     - % of commented methods
>>>     - % of commented classes
>>>
>>> Then three graphs were drawn:
>>>
>>>     - Methods in classes
>>>     - Class inheritance depth
>>>     - Lines in methods
>>>
>>> Results can be seen here:
>>>
>>> https://docs.google.com/spreadsheet/ccc?key=0Atnb1W9vuq9ndG4wbUpxNXpKQnFZRlFyQXpHclhZa2c#gid=1
>>>
>>>
>>> The code measuring all above is here:
>>>
>>>      http://www.squeaksource.com/WebCodeStats.html
>>>
>>>
>>> Hope this helps
>>> Janko
>>>
>>>
>>> Dne 31. 03. 2013 09:23, piše Hernán Morales Durand:
>>>> Hi there,
>>>> Guys, what are you using to measure logical lines of code (LOC) in
>>>> Pharo?
>>>> Given I am measuring a script, is there any other software measure you
>>>> may recommend?
>>>> Cheers,
>>>>
>>>> Hernán
>>>>
>>>
>>
>>
>>
>


Reply | Threaded
Open this post in threaded view
|

Re: [Pharo-users] SLOC in Smalltalk

Marcus Denker-4
In reply to this post by hernanmd

On Apr 2, 2013, at 4:54 AM, Hernán Morales Durand <[hidden email]> wrote:

> Hi Janko. Thanks for your useful package.
>
> Apparently there is some issue with #linesOfCode. The dummy expression below return 5 instead of 4 in Pharo 1.4 and 2 because is counting the autogenerated 'DoIt' selector.
>
> (UndefinedObject evaluatorClass new
> compileNoPattern: '| oc |
> oc := OrderedCollection new: 20.
> oc add: 1.
> oc size'
> in: UndefinedObject
> context: nil
> notifying: nil
> ifFail: []) generate linesOfCode

Hello,

I do not think that this is wrong. The doit *does* contain a selector. if #linesOfCode would contain a special
case for doits, it would be inconsistent.

E.g. print this:

thisContext method sourceCode

-->

 'DoIt
        ^ thisContext method sourceCode'

There is a Doit. There is even a return in the that is generated… and the doit is actually pretty-printed:



thisContext
method
linesOfCode

--> 2

So in short: dots are special, there is no need to change #linesOfCode, as there is no thinkable change
that would make any sense.

In general, LOC as a metric is not that good. It is better than nothing, but it makes more sense to count
e.g. message sends or use more advanced metrics on the AST (not every statement adds the same
to complexity, e.g. conditionals versus simple statements).


        Marcus