[Shootout-list] Re: Optimizing for speed vs. beauty
Brandon J. Van Every
vanevery@indiegamedesign.com
Thu, 30 Sep 2004 01:28:43 -0700
Bengt Kleberg wrote:
> Brandon J. Van Every wrote:
> ...deleted
> >
> > Well, I'm of the camp that LOC is a big, ancient lie. For
> instance, all
> > of the ASM code I've ever written professionally has had lotsa extra
> > LOCs just to keep things clear. And so did the C code
> which preceeded
> > it, so that the compiler generated ASM code would stand a chance of
> > being what I wanted, without having to do it all by hand.
> Extra LOC was
> > clearly the most 'beautiful' way to handle my class of low-level
> > problems. Yet I imagine some HLL guy would just make vampire cross
>
> 1 if you mean that you have to write comments to explain what you are
> doing, then comments are not counted as lines of code.
No, I mean that I put 1 ASM instruction per line. C code that might get
turned into ASM later, or that will produce proper ASM if handed the
right instruction sequence, gets written exactly the same way. 1
ASM-equivalent instruction per line.
LOC is bullshit. It doesn't respect problem domains.
> as an aside i
> find this to be wrong. they should be since some langauages
> needs lots of comments, while others do not.
Again bullshit. *Human beings* need comments, languages do not.
> 2 the number of bugs per LOC is about constant for all languages
For what, the constant valued mythical 'average' or 'median' programmer?
In a 7 person elite team, or a 100 person drool team at some dinosaur
corporation that everyone's either fleeing or milking because it'll go
bankrupt in 2 years? More bullshit.
I would have thought Fred B. Brooks' "The Mythical Man Month" would have
put all this stuff to rest long ago, but I guess you can't get people to
stop believing in LOC.
> (atleast this was the case when i partook in a course on
> safeware about
> 5 years ago). therefore one might want a low LOC count per program.
Low compared to what? Compared to the mathematical decomposition of the
task you have to do, or some dream of yours? How on Earth would you
objectively establish a lower bound for LOC? Transform your code like
some obfuscated C contest until it's all on one line?
> 3 it is possible to ''cheat'' by having artificially long
> lines. those ''cheats'' are not of interest for this discussion.
But you're on a slippery slope as to what's a 'cheat' and what's 'good
style'.
Cheers, www.indiegamedesign.com
Brandon Van Every Seattle, WA
"The pioneer is the one with the arrows in his back."
- anonymous entrepreneur