[thelist] Coding style (was: PAGE OPTIMIZATION: source readab ility v. download w eight)

Jonathan_A_McPherson at rl.gov Jonathan_A_McPherson at rl.gov
Wed Jun 12 15:50:01 CDT 2002


> This particular discussion is interesting.

Indeed. (-:

>
> Define "cleaner"...to me "cleaner" is a subjective term. Whats clean to
one, isn't to another. > For ages I preferred the above method...but...then
I saw people using the other way
>
> blah()
> {
>  more blah
> }
>
> And when my code starting getting longer I realized that *for me* it was
much easier to read. So
> I've started doing all my JS like this and really liking how it helps me
find functions faster and
> allows me to read it easier. I don't say this is the right or wrong way,
just the way I prefer. To
> *me* its "cleaner."

Point taken. But interestingly enough, I went the other way -- from an
advocate of the style you mention above to the style I use now. It looks
better to me. And you're right; there's a large amount of personal
preference involved.

> Ditto for you Linus - who cares. Celebrity hardly makes one opinion more
valid than another's.

More valid, no. But, unless your code is for only-your-personal-use, the
odds are fair to middlin' that the next guy who encounters your code will
not want to try to decode your pretty indent/brace style. He'll want it to
look exactly like all the other code he has ever worked with. And that style
is likely to be the standard K&R C style, especially since so many
high-profile entities (Linus being only one example) use it.

Make no mistake -- I'm not saying that K&R/Linus/GNU dictate style because
they're smarter or know the Right Way to Do Things. They dicate style
because they are popular, and people imitate them.

--
Jonathan McPherson, LMIT/SD&I
Software Engineer & Web Systems Analyst
email / jonathan_a_mcpherson at rl dot gov
phone / 509.373.0150



More information about the thelist mailing list