Google Groups Home
Help | Sign in
Coding style - a non-issue
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  Messages 51 - 75 of 345 - Collapse all < Older  Newer >
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
Galappatti, Kishantha  
View profile
(1 user)  More options Nov 30 2001, 2:45 pm
Newsgroups: fa.linux.kernel
From: "Galappatti, Kishantha" <Kishantha.Galappa...@gs.com>
Date: Fri, 30 Nov 2001 19:45:44 GMT
Local: Fri, Nov 30 2001 2:45 pm
Subject: RE: Coding style - a non-issue
i agree with that dana. Sure coding style is important but lets not get
personal here. I personally think there should be an established coding
style that should be kept to as much as possible but the way to implement
that is by helping the contributors to do so with tools etc, not by
castigating them in a "hall of shame". Isn't open source about inclusion and
creativity?
Just my opinion.

--kish


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Paul G. Allen  
View profile
 More options Nov 30 2001, 3:09 pm
Newsgroups: fa.linux.kernel
From: "Paul G. Allen" <pgal...@randomlogic.com>
Date: Fri, 30 Nov 2001 20:09:37 GMT
Local: Fri, Nov 30 2001 3:09 pm
Subject: Re: Coding style - a non-issue

Jeff Garzik wrote:

> We could definitely use a ton more comments... patches accepted.

I've actually thought of doing just that. :)

Alas, I'm too busy coding other things right now, so kernel stuff
(unless I need something to make the other project I'm working on
work/work better) will just have to wait. Hell, I'm even behind 2 or 3
kernel versions on the documentation I've been putting on my web site.
:(

> >  - Opening curly braces at the end of a the first line of a large code
> > block making it extremely difficult to find where the code block begins
> > or ends.

> use a decent editor

A person shouldn't _need_ a decent editor to pick out the beginning/end
of a code block (or anything else for that matter). The problem is
exacerbated when such a block contains other blocks and quickly picking
out where each begins/ends becomes tiresome. I _do_ have excellent
editors, IDEs, and source code browsers and have used many different
kinds in many different jobs. They still can not replace what the human
eye and mind perceive.

> >  - Short variable/function names that someone thinks is descriptive but
> > really isn't.

> not all variable names need their purpose obvious to complete newbies.
> sometimes it takes time to understand the code's purpose, in which case
> the variable names become incredibly descriptive.

It should not take "time" to discover the purpose of _any_ variable or
function, or file, whether newbie or not. The point of coding is to
solve a problem, not perform an excersise in deductive or logical
reasoning before the problem (which usually involves further logical
reasoning) can be solved.

PGA
--
Paul G. Allen
UNIX Admin II ('til Dec. 3)/FlUnKy At LaRgE (forever!)
Akamai Technologies, Inc.
www.akamai.com
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jeff Garzik  
View profile
 More options Nov 30 2001, 3:20 pm
Newsgroups: fa.linux.kernel
From: Jeff Garzik <jgar...@mandrakesoft.com>
Date: Fri, 30 Nov 2001 20:20:28 GMT
Local: Fri, Nov 30 2001 3:20 pm
Subject: Re: Coding style - a non-issue

"Paul G. Allen" wrote:
> It should not take "time" to discover the purpose of _any_ variable or
> function, or file, whether newbie or not. The point of coding is to
> solve a problem, not perform an excersise in deductive or logical
> reasoning before the problem (which usually involves further logical
> reasoning) can be solved.

Part of the problem being solved by Linux kernel code is efficient long
term maintenance and efficient peer review.  Overly verbose code does
not solve these problems.

        Jeff

--
Jeff Garzik      | Only so many songs can be sung
Building 1024    | with two lips, two lungs, and one tongue.
MandrakeSoft     |         - nomeansno

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Paul G. Allen  
View profile
 More options Nov 30 2001, 3:23 pm
Newsgroups: fa.linux.kernel
From: "Paul G. Allen" <pgal...@randomlogic.com>
Date: Fri, 30 Nov 2001 20:23:03 GMT
Local: Fri, Nov 30 2001 3:23 pm
Subject: Re: Coding style - a non-issue

antirez wrote:

> On Fri, Nov 30, 2001 at 10:20:43AM -0800, Paul G. Allen wrote:
> > antirez wrote:
> > A variable/function name should ALWAYS be descriptive of the
> > variable/function purpose. If it takes a long name, so be it. At least
> > the next guy looking at it will know what it is for.

> I agree, but descriptive != long

> for (mydearcountr = 0; mydearcounter < n; mydearcounter++)

> and it was just an example. Read it as "bad coding style".

Well if you're counting dear in the kernel, I'd say you have more
problems than your coding style. ;)

PGA
--
Paul G. Allen
UNIX Admin II ('til Dec. 3)/FlUnKy At LaRgE (forever!)
Akamai Technologies, Inc.
www.akamai.com
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Paul G. Allen  
View profile
 More options Nov 30 2001, 3:30 pm
Newsgroups: fa.linux.kernel
From: "Paul G. Allen" <pgal...@randomlogic.com>
Date: Fri, 30 Nov 2001 20:30:06 GMT
Local: Fri, Nov 30 2001 3:30 pm
Subject: Re: Coding style - a non-issue

John Kodis wrote:

> On Fri, Nov 30, 2001 at 02:00:18PM -0500, Jeff Garzik wrote:

> > Human beings know and understand context, and can use it
> > effectively.  'idx' or 'i' or 'bh' may make perfect sense in
> > context.  There is absolutely no need for
> > JournalBHThatIsStoredAndSyncedWithSuperblock.

JounalBH would be far better than i or idx.

> Mathematics has a rich tradition of using short variable names such as
> "pi" rather than something like "circle-circumference-to-diameter-ratio".
> They keep formulas from becoming unreadably long, and have a meaning
> which is well understood in context.  While the long version may more
> self-explainatory, it's the short form which is universally preferred.

While 'pi', 'e', 'theta', 'phi', etc. are universally understood, things
like 'i', 'a', and 'idx' are not. I can use these for anything I want
and even for more than one thing, and they say nothing about what they
are for. 'i', 'j', etc. are fine as loop counters and array indexes
where their meaning is apparent by context, but are _not_ fine in other
situations. You (or the person that wrote the code) may think that the
name is perfectly fine, but someone else that thinks a bit different may
not.

PGA
--
Paul G. Allen
UNIX Admin II ('til Dec. 3)/FlUnKy At LaRgE (forever!)
Akamai Technologies, Inc.
www.akamai.com
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Andrew Morton  
View profile
 More options Nov 30 2001, 3:50 pm
Newsgroups: fa.linux.kernel
From: Andrew Morton <a...@zip.com.au>
Date: Fri, 30 Nov 2001 20:50:36 GMT
Local: Fri, Nov 30 2001 3:50 pm
Subject: Re: Coding style - a non-issue

Jeff Garzik wrote:

> We could definitely use a ton more comments... patches accepted.

Too late.  Useful comments go in during, or even before the code.

While we're on the coding style topic: ext2_new_block.

-
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Tim Hockin  
View profile
 More options Nov 30 2001, 4:22 pm
Newsgroups: fa.linux.kernel
From: Tim Hockin <thoc...@hockin.org>
Date: Fri, 30 Nov 2001 21:22:37 GMT
Local: Fri, Nov 30 2001 4:22 pm
Subject: Re: Coding style - a non-issue

> >     Of course, more comments and more descriptive names doesn't harm,
> > but some times they bloat the code...

> Actually it bloats the source (we all know C++ bloats the resulting code
> ;), but what's wrong with that? At least a person can understand what's
> going on and get to coding, instead of deciphering.

I'd happily download 50 MB kernel tarballs, if the extra 25 MB were
ACCURATE and UP TO DATE comments.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Larry McVoy  
View profile
 More options Nov 30 2001, 5:08 pm
Newsgroups: fa.linux.kernel
From: Larry McVoy <l...@bitmover.com>
Date: Fri, 30 Nov 2001 22:08:54 GMT
Local: Fri, Nov 30 2001 5:08 pm
Subject: Re: Coding style - a non-issue
This is my last post on this topic, I don't think I can say more than I have.

On Fri, Nov 30, 2001 at 10:54:39PM +0100, Daniel Phillips wrote:
> On November 30, 2001 08:05 pm, Larry McVoy wrote:
> > Huh.  Not sure I agree with that either.  It's definitely a dicey area
> > but go through the archives (or your memory if it is better than mine)
> > and look at how the various leaders here respond to bad choices.  It's
> > basically public humiliation.  Linus is especially inclined to speak
> > his mind when he sees something bad.  And people stick around.

> There's an additional pattern, you'll notice that the guys who end up wearing
> the dung are the ones with full time Linux programming jobs, who basically
> have no option but to stick around.  Do that to every newbie and after a
> while we'll have a smoking hole in the ground where Linux used to be.

> A simple rule to remember is: when code is bad, criticize the code, not the
> coder.

Your priorities are upside down.  The code is more important than the
coder, it will outlive the coder's interest in that code.  Besides,
this isn't some touchy feely love fest, it's code.  It's suppose to
work and work well and be maintainable.  You don't get that by being
"nice", you get that by insisting on quality.  If being nice worked,
we wouldn't be having this conversation.

> > I think the thing you are missing is that what I am describing is a lot
> > like boot camp.  Someone with more knowledge and experience than you
> > yells at your every mistake, you hate it for a while, and you emerge
> > from boot camp a stronger person with more skills and good habits as
> > well as a sense of pride.

> Thanks, but I'll spend my summer in some other kind of camp ;-)  I'm sure it
> works for some people, but mutual respect is more what I'm used to and prefer.

The problem here is that you are assuming that yelling at someone means
that you don't respect that someone.  Nothing could be further from the
truth.  If you didn't respect them enough to think you could get good
results from them, I doubt you'd be yelling at them in the first place.
Don't confuse intense demands for excellence with a lack of respect,
that's not the case.

> > If there was a way to "lead by example" and
> > accomplish the same goals in the same time, don't you think someone
> > would have figured that out by now?

> Somebody did, and as hard as it is for some to fit it into their own model of
> the universe, there is somebody leading by example, not running a command
> economy but a self-organizing meritocracy.  Do we achieve the same goals in
> the same time?  Sometimes it doesn't seem like it, but because this thing
> just keeps crawling relentlessly forward on a thousand fronts, in the end we
> accomplish even more than Sun does.

Bah.  Daniel, you are forgetting that I know what Sun has done first hand
and I know what Linux has done first hand.  If you think that Linux is
at the same level as Sun's OS or ever will be, you're kidding yourself.
Linux is really cool, I love it, and I use it every day.  But it's not
comparable to Solaris, sorry, not even close.  I'm not exactly known for
my love of Solaris, you know, in fact I really dislike it.  But I respect
it, it can take a licking and keep on ticking.  Linux isn't there yet
and unless the development model changes somewhat, I'll stand behind my
belief that it is unlikely to ever get there.  
--
---
Larry McVoy              lm at bitmover.com           http://www.bitmover.com/lm
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Andrew Morton  
View profile
 More options Nov 30 2001, 5:19 pm
Newsgroups: fa.linux.kernel
From: Andrew Morton <a...@zip.com.au>
Date: Fri, 30 Nov 2001 22:19:51 GMT
Local: Fri, Nov 30 2001 5:19 pm
Subject: Re: Coding style - a non-issue

Larry McVoy wrote:

> Linux isn't there yet
> and unless the development model changes somewhat, I'll stand behind my
> belief that it is unlikely to ever get there.

I am (genuinely) interested in what changes you think are needed.

-
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
rddunlap  
View profile
 More options Nov 30 2001, 5:57 pm
Newsgroups: fa.linux.kernel
From: <rddun...@osdl.org>
Date: Fri, 30 Nov 2001 22:57:03 GMT
Local: Fri, Nov 30 2001 5:57 pm
Subject: Re: Coding style - a non-issue

On Fri, 30 Nov 2001, Andrew Morton wrote:
| Larry McVoy wrote:

| >
| > Linux isn't there yet
| > and unless the development model changes somewhat, I'll stand behind my
| > belief that it is unlikely to ever get there.
|
| I am (genuinely) interested in what changes you think are needed.

Same here, regarding both development model and OS functionality,
reliability, etc.
--
~Randy

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Paul Jackson  
View profile
 More options Nov 30 2001, 6:15 pm
Newsgroups: fa.linux.kernel
From: p...@sgi.com (Paul Jackson)
Date: 30 Nov 2001 23:15:18 GMT
Local: Fri, Nov 30 2001 6:15 pm
Subject: Re: Coding style - a non-issue
Jeff wrote:

|> Part of the problem being solved by Linux kernel code is
|> efficient long term maintenance and efficient peer review.
|> Overly verbose code does not solve these problems.

Code serves two masters - it instructs computers, and it
instructs humans (code readers, maintainers, forgetful authors
a month later, ...).

    Often the first master, the computer, is the less demanding.
    One can usually beat the code into submission with enough
    effort, even if uninspired.  There are exceptions to this,
    such as perhaps virtual memory and C++ compilers, which
    get just plain hard for most humans.

    The second master is usually the more demanding.  Great code
    not only works, but is also a delight to read and maintain.

Like literature, there is perhaps a typical taxonomy of
code, by how readable it is:

  - there's quick draft hurried code with terse names and
    confused structure, free of comment
  - there's more methodical, verbose code - overburdened
    with uninspired, but exhaustive comments and baroque
    code embellishments
  - there's the eloquent gem, the polished pearl, the O'Henry
    short story, the Dijkstra algorithm - which looks sometimes
    like the hurried quick draft until you realize how hard it
    is to improve or simplify it, and until you observe either
    the many discarded drafts on the cutting room floor, or
    that the author was inspired with genius.

So, yes, overly verbose code doesn't solve problems, but it
might show more effort to communicate with humans than confused
early drafts.

Unfortunately, that extra effort can sometimes be more of an
impediment than a help.  It can be easier to nurse terse early
confused drafts into decent code than overweight bloat ... less
shit to shovel.

--

                          I won't rest till it's the best ...
                          Manager, Linux Scalability
                          Paul Jackson <p...@sgi.com> 1.650.933.1373


    Reply to author    Forward