[Haskell-cafe] Lines of code metrics
waldmann at imn.htwk-leipzig.de
Thu Aug 21 15:31:26 EDT 2008
> Just curious, has anybody tried to apply Halstead's code metrics [...]
As I understand it, Halstead's metric
punishes the re-use of "operands" (= variables).
This is what happens if you start your program
with a bunch of global definitions
(e.g. int i,j,k,l because you might want them as loop indices)
that actually should be local.
This totally does not apply to Haskell:
there is no assignment, you cannot overwrite,
so indeed each operand ("variable") serves only one purpose,
as it should be.
NB: My private set of Haskell metrics:
* lines of code (per declaration) (should be <= 5)
* number of declarations (per module) (should be <= 5 as well :-)
* number of usages of Int, String, List, IO (should be <= 0 :-) :-)
Not entirely joking - J.W.
More information about the Haskell-Cafe