
Hi, Greg Fitzgerald wrote:
Does anyone know of a good case study comparing a project written in C versus one written in Haskell? I'm mostly looking for a comparison of lines of code, but any other metric, such as time to market and code quality metrics could also be
Just curious, has anybody tried to apply Halstead's code metrics (see e. g. http://www.sei.cmu.edu/str/descriptions/halstead_body.html), but there is a 70s' book titled "Elements of Software Science" to Haskell and other functional languages vs. C and other imperative languages? I myself played with these calculations in late 80s trying to estimate code quality of Pascal programs on PDP-11, but that was a pain to count functions' operands properly as they might come from global variables. Application of these formulas to functional languages might be mich cleaner, so has anybody tried? Thanks. -- Dimitry Golubovsky Anywhere on the Web

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.

On Thu, 21 Aug 2008, Johannes Waldmann wrote:
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 :-) :-)
* number of usages of unsafePerformIO, unsafeInterleaveIO, use of Ptr or IO at all These would be nice metrics for me to decide, whether I want to download a package from Hackage.
participants (3)
-
Dimitry Golubovsky
-
Henning Thielemann
-
Johannes Waldmann