Mailing List Archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [tlug] Large project Agile development



On 2008-08-19 18:48 +0900 (Tue), Hung Nguyen Vu wrote:

> > Along that line of thought, I'd estimate that Haskell runs about
> > 5-20% the linecount of Java for equivalant functionality.
> 
> I will not look at LOC to judge a language is better than the others.

Well, you should. It's been shown enough times to convince me that
maintenance costs for code of similar quality are pretty much
proportional to the number of LoC, regardless of language. And this
makes intuitive sense, as well. The more code you have to read to
understand what's going on, and the more you have to dig into other
files, the longer it's going to take.

> C is verbose while it runs a little faster if well crafted.

Actually, there are programs that run faster in languages such as
Haskell than they do in C. C just doesn't have enough type information
to do some of the optimization that can be done with code in more
sophisticated languages. This is rare, though.

But yes, you're right, generally the fastest stuff can be done in C and
assembler. At massive cost, mind you. 

Do keep in mind that anybody who is going to get consistently fast code
in any language is going to have a good C coder's knowledge of computer
architecture, and will probably be able to switch to C when necessary.

> I have no idea about Haskell but if you mean by generic programming,
> Haskell saves 5-20% LOC then I have to agree. Such code will be compact
> but harder to maintain.

You've got it backwards: Haskell *uses* about 5-20% LOC. I.e., A ten
thousand line Java program may well be a thousand lines of Haskell.

Have a look at this paper:

    http://www.mcs.vuw.ac.nz/courses/COMP432/2008T2/docs/HaskellvCjfp.pdf

This compares several different implementations of a reasonably
sophisticated math-heavy computational system. The C++ code is 1105
lines; the Haskell code is about 8% of that: 85 lines.

> Agg is an example of using C++ template: compact, short, fast and
> almost no comment in the code. It saves about 40% LOC in comparison to
> cairo when doing the same task.

Well, comments don't generally count for LoC, unless you need the
comments because your code is compact instead of concise. And I'm
looking for more than 40% savings these days; I was easily getting that
from my switch from Java to Ruby.

On 2008-08-19 21:44 +0900 (Tue), Hung Nguyen Vu wrote:

> By "compact", I mean short, generic and sometimes hackerish. For smart
> and experience programmers, such code is not a matter but average
> coders will find it hard to maintain.

Quite possibly. Then again, "average" coders will find large, messy
programs hard to maintain, too. In general, average coders will lead
you to an expensive, nasty ending; you need at least one or a few good
coders on your team.

cjs
-- 
Curt Sampson       <cjs@example.com>        +81 90 7737 2974   
Mobile sites and software consulting: http://www.starling-software.com


Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links