object file size is reduced after build

C

CBFalconer

Mark said:
Not a meaningful example. LOC is a statistical measure: like all
such measures, you can't apply it to small population sizes. I
_think_ we can agree a 5 MLOC programme is probably less complex
than a 50 MLOC one?

And sure, you can artificially inflate linecounts - but your
fingers will start to complain doing that on even a thousand-line
programme, let alone a million-liner...

Any you are claiming that you don't see the equivalent of my second
example every day or more?
 
D

Default User

Mark said:
(e-mail address removed) wrote:

Wouldn't work - everyone in the firm would use it, and the PHBs would
just rebase the payments scale... :-(


Well, duh, you don't TELL cow-orkers about it.




Brian
 
M

Mark McIntyre

CBFalconer said:
Any you are claiming that you don't see the equivalent of my second
example every day or more?


I'm saying that the examples were statistically meaningless. If you
sampled the codebase of any large programme at random, some samples will
be more spaced out than others, as a result of programmer preference,
developments in house style and probably editor technology. Two random
snippets won't tell you anything useful however.

By the way I write in style 2 pretty much exclusively, to improve
clarity. Don't you?
 
J

jacob navia

Mark said:
I'm saying that the examples were statistically meaningless. If you
sampled the codebase of any large programme at random, some samples will
be more spaced out than others, as a result of programmer preference,
developments in house style and probably editor technology. Two random
snippets won't tell you anything useful however.

By the way I write in style 2 pretty much exclusively, to improve
clarity. Don't you?

What is clarity?

It is being able to see more of the program in the screen at a given
time without having to scroll down or up...
Verbose programs that go over lines and lines need constant scrolling to
see read them.

With less verbosity and unnecessary white space, you can see
the whole function in the screen at a single page, what makes much more
to improve things that verbose line style.

As anything, this rule can be perverted too, and you get obfuscated
code.

But

if (i=foo(baz)) goo(sss);

is perfectly clear and readable to me...
 
S

santosh

jacob said:
What is clarity?

It's a measure of how quickly and easily a programmer reasonably
competent in the language can understand the purport of a piece of
code.
It is being able to see more of the program in the screen at a given
time without having to scroll down or up...
Verbose programs that go over lines and lines need constant scrolling
to see read them.

Either extreme defeats clarity. Excessively terse code makes you waste
time figuring it out while excessively verbose code makes you waste
time ploughing through it.
With less verbosity and unnecessary white space, you can see
the whole function in the screen at a single page, what makes much
more to improve things that verbose line style.

As anything, this rule can be perverted too, and you get obfuscated
code.

But

if (i=foo(baz)) goo(sss);

is perfectly clear and readable to me...

Yes. This particular construct is a common idiom and is can be quickly
recognised. But imagine hundreds of thousands of lines like this, all
cramped together. Some vertical space is okay.

I'd prefer:

if (i = foo(baz))
goo(flimdiddle);
 
G

Gordon Burditt

Ah, obviously the two following snippets have widely differing
Not a meaningful example. LOC is a statistical measure: like all such
measures, you can't apply it to small population sizes. I _think_ we
can agree a 5 MLOC programme is probably less complex than a 50 MLOC one?

No: not when there are simple "LOC inflater" algorithms like
"replace every newline with 1 trillion newlines".

Remember, use of a metric for performance evaluations or payment
for work alters the result of the work next time. You need to
assume people will try to "cheat", especially if it's not illegal.
And sure, you can artificially inflate linecounts - but your fingers
will start to complain doing that on even a thousand-line programme, let
alone a million-liner...

Not when you have a computer do it for you.

You might get a metric that is a little harder to cheat with
a definition like:
- Count the number of lines of code *after* running it
through GNU indent with specified command-line options.
- Lines that are empty or consist entirely of whitespace or
comments or parts of comments or empty statements do not count.
 
G

Gordon Burditt

The "line of code" is an incredibly silly measure of code complexity.
No that does not meet constraint 3. Claiming that it does would imply
that LOC is completely and absolutely unrelated to code complexity.

I claim that LOC is completely and absolutely unrelated to code
complexity *written by a programmer who knows what your metric is
and who knows s/he will be paid according to the metric*.
 
C

CBFalconer

Mark said:
.... snip ...

By the way I write in style 2 pretty much exclusively, to
improve clarity. Don't you?

No, I write in style 1 pretty much exclusively, in order to improve
clarity.
 
I

Ian Collins

jacob said:
With less verbosity and unnecessary white space, you can see
the whole function in the screen at a single page, what makes much more
to improve things that verbose line style.
If you have to scroll to see a whole function on any half decent
display, your function is too long.
 
S

santosh

Gordon Burditt wrote:

You might get a metric that is a little harder to cheat with
a definition like:
- Count the number of lines of code *after* running it
through GNU indent with specified command-line options.
- Lines that are empty or consist entirely of whitespace or
comments or parts of comments or empty statements do not count.

This is good simple way to quantify code volume, but it has nothing to
do with code complexity unless you claim volume and complexity are
directly proportional.

Complexity is far more subjective that a mere count of code statements
etc. What may be "complex" to one programmer would be routine stuff for
another.
 
J

James Kuyper

Gordon Burditt wrote:
....
I claim that LOC is completely and absolutely unrelated to code
complexity *written by a programmer who knows what your metric is
and who knows s/he will be paid according to the metric*.

The times when I've been asked by upper management to give them line
counts, it had nothing to do with determining how much anyone would get
paid, and the code had not been written with the expectation that there
would be any such a connection.

In my project, how well the program works has a lot more to do with
anyone's pay level than how big it is. If anything, a large size might
count (VERY slightly) against the programmer, by implying that the
program was overly complex for the tasks it needed to perform.

How well the program works is, in turn, less important than meeting
deadlines, as long as the code does meet it's minimum requirements by
the time the deadline arrives. Since the requirements are more easily
negotiable than deadlines, this means that meeting deadlines is the
single most important thing. I'm not happy with that fact, but I can
understand why meeting deadlines is a high priority, when several dozen
scientific teams from around the world are waiting for our programs to
work correctly before they can test whether theirs are working correctly.
 
M

Mark McIntyre

Mark McIntyre wrote:

(of a style with sensible amounts of whitespace vs a style
withnowhitespaceatall)
No, I write in style 1 pretty much exclusively, in order to improve
clarity.

You have a very strange idea of clarity. Do you by any chance write EC
directives in your spare time? :)
 
M

Mark McIntyre

How well the program works is, in turn, less important than meeting
deadlines,

How horribly true that is
as long as the code does meet it's minimum requirements by
the time the deadline arrives.

or thereabouts... :-(

You missed out the first priority of course -coming in on budget...
 
C

CBFalconer

Mark said:
(of a style with sensible amounts of whitespace vs a style
withnowhitespaceatall)


You have a very strange idea of clarity. Do you by any chance
write EC directives in your spare time? :)

Just to avoid misconceptions, here is my recommended bit:

if (i = foo(baz)) goo(flimdiddle);

which is quite obvious. goo is called if i is nonzero. There are
adequate blanks to separate ids from operators, etc.
 
I

Ian Collins

CBFalconer said:
Just to avoid misconceptions, here is my recommended bit:

if (i = foo(baz)) goo(flimdiddle);

which is quite obvious. goo is called if i is nonzero. There are
adequate blanks to separate ids from operators, etc.
All fine and dandy until you want to set a break/watch point on that
particular call to goo().
 
R

Richard

CBFalconer said:

Which is why it's the general consensus that your code layout is
atrocious and not to be used as a paragon of good style. Having multiple
statements on one line like this makes code very hard to read and
debug. This is never, ever a good idea.

if (i = foo(baz))
goo(flimdiddle);

Shows immediately at a casual glance without even reading the code in
detail that a logic condition can cause a subroutine call and the
maintainer might want to keep an eye there. But this has been discussed
ad-infinitum.
 
M

Mark McIntyre


Which is nice for you, but a bit of a nightmare for the poor maintenance
droid who has to disentangle your code. I'm all for compactness, but not
at the expense of either ease of maintenance or clarity for less expert
programmers. Writing dense code just for the sake of it smacks of, well,
elitism.
 
G

Golden California Girls

Mark said:
Which is nice for you, but a bit of a nightmare for the poor maintenance
droid who has to disentangle your code. I'm all for compactness, but not
at the expense of either ease of maintenance or clarity for less expert
programmers. Writing dense code just for the sake of it smacks of, well,
elitism.

Ah, yes, the APL one liner competition. Fun but not for serious stuff.

But that attitude of elitism has completely taken over the standards process.
In the name of allowing anything they have forgotten the cardinal rule of a good
standard. A good standard should make errors obvious if it can't make them
impossible. This is because writing the standard is done once, using the
standard is done billions of times. Fixing it in the standard prevents billions
of wasted hours of time down the road, never mind the secondary effects. But
this is the hard road to take, so it isn't done.

Perhaps if this thought was tossed in at the start of every standards committee
meeting and message, "The standard you are working on today will be used by a D
student tomorrow to secure your pension and bank account." it would give them
the proper perspective on what they are doing.
 
C

CBFalconer

Mark said:
Which is nice for you, but a bit of a nightmare for the poor
maintenance droid who has to disentangle your code. I'm all for
compactness, but not at the expense of either ease of maintenance
or clarity for less expert programmers. Writing dense code just
for the sake of it smacks of, well, elitism.

Ah, but the debugger never crosses my mind, because I virtually
never use them. If it is of real use to the end user, he is quite
welcome to insert a <return> before the goo call and recompile.

My objective is to make the source code readable and sensible. It
is something like paragraphing prose. Every so often a totally
blank line appears to separate thoughts. More often the separation
is done by breaking into functions. The inline directive is very
handy for combining this with minimum function call overhead.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top