It seems to make sense to me if you think of code optimization (I assume
Pharo does this). Indeed
^true :or false
must always execute both paths, but
^false :or true
only needs to execute one path to have a result of true for the OR. There's
a similar case for :and with false values.
On Tue, Nov 14, 2017 at 4:17 AM, Nicolas Anquetil <nicolas.anquetil(a)inria.fr
wrote:
>
> Yes typically, it is easier to count cyclomatic as +1 for each "testing
> statement" (if, loops)
>
> May be the rational is that #or: is basically the same thing as #ifFalse:
> and #and: is similar to #ifTrue: ?
>
> In FAST for pharo, there is an algorithm that computes cyclomatic also, it
> uses the same ideas (#or: and #and: add 1 to cyclomatic)
>
> nicolas
>
> On 12/11/2017 18:11, Stéphane Ducasse wrote:
>
> Normally cyclo is
> the number of paths
> so
>
> 1 for the true (the main flow)
> + on for the true and the or: the alternative flow.
>
> Stef
>
> On 12 Nov 2017, at 18:06, Alidra Abdelghani <alidrandco(a)yahoo.fr
wrote:
>
> Hi,
>
> I have just noticed that when calculating the cyclomatic complexity of a
> method, Moose adds 1 for each boolean operator in the code.
> For instance, the cyclomatique complexity of
>
> *SomeClass>>aMethod *
> * ^true or:false *
>
> equals 2
>
> This is funny because I found such a thing anywhere else.
>
> In addition, In the method
> *RBVisitorForFAMIXMetrics>>computeCyclomaticNumber:* there is a comment
> that says :
>
> *"The score is basically the number of decision points in a routine + 1.
> Decision points are taken to be conditionals and loops.”*
>
> but then in the code, there is another strange comment :*"-- HERE STARTS
> THE OLD ERRORFUL IMPL --"*
> and some lines further :
>
> *cyclo := self cyclomaticNumber + 1 + booleanOperators.*
>
> So my question is : Why booleanOperators is used to calculate cyclomatique
> complexity. Wouldn’t it be simpler to do *cyclo := self cyclomaticNumber
> + 1?*
>
> *Thanks in advance*
> _______________________________________________
> Moose-dev mailing list
> Moose-dev(a)list.inf.unibe.ch
>
https://www.list.inf.unibe.ch/listinfo/moose-dev
>
>
> --------------------------------------------
> Stéphane Ducasse
>
http://stephane.ducasse.free.fr
>
http://www.synectique.eu /
http://www.pharo.org
> 03 59 35 87 52
> Assistant: Julie Jonas
> FAX 03 59 57 78 50
> TEL 03 59 35 86 16
> S. Ducasse - Inria
> 40, avenue Halley,
> Parc Scientifique de la Haute Borne, Bât.A, Park Plaza
> Villeneuve d'Ascq 59650
> France
>
>
>
> _______________________________________________
> Moose-dev mailing
listMoose-dev@list.inf.unibe.chhttps://www.list.inf.unibe.ch/listinfo/moose-dev
>
>
> --
> Nicolas Anquetil
> RMod team -- Inria Lille
>
>
> _______________________________________________
> Moose-dev mailing list
> Moose-dev(a)list.inf.unibe.ch
>
https://www.list.inf.unibe.ch/listinfo/moose-dev
>
>