By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,606 Members | 3,832 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,606 IT Pros & Developers. It's quick & easy.

JavaScript Convention Documents

P: n/a
I asked Google for "javascript code conventions". He pointed me to
seven convention documents. (More exactly, to Crockford and six lesser
convention documents.) I have compiled all the conventions in a single
document, here:

http://www.martinrinehart.com/articl...nventions.html

I stress that these are NOT my conventions; this is a compilation of
the others. My job: clerk. I tried to be a good clerk, organizing
sensibly so you can find things easily. Not always easy in a field
descended from Sun's Java conventions.

I was frankly disappointed to see that from all the available naming
styles (UpperAndLower, lowerAndUpper, ALLCAPS,
lower_with_underscores, ...) JavaScripters do almost nothing to use
these in an intelligent way. We should have conventions, as Java does,
that let you see immediately that you are looking at an object
reference, public method, etc.

For what it's worth, 6 conventions say JavaScript, one says
Javascript. None use anything else.

I'd like this thread to stick to the document (fixes, documents I
should include, ...) If you want to argue for or against particular
issues, please focus on the issue in a separate post. I'll set things
off in my next post.
Oct 31 '08 #1
Share this Question
Share on Google+
8 Replies


P: n/a
On Oct 31, 5:29*pm, Martin Rinehart <MartinRineh...@gmail.comwrote:
I asked Google for "javascript code conventions". He pointed me to
seven convention documents. (More exactly, to Crockford and six lesser
convention documents.) I have compiled all the conventions in a single
document, here:

http://www.martinrinehart.com/articl...nventions.html

I stress that these are NOT my conventions; this is a compilation of
the others. My job: clerk. I tried to be a good clerk, organizing
sensibly so you can find things easily. Not always easy in a field
descended from Sun's Java conventions.
What field is descended from Sun's Java conventions?
>
I was frankly disappointed to see that from all the available naming
styles (UpperAndLower, lowerAndUpper, ALLCAPS,
lower_with_underscores, ...) JavaScripters do almost nothing to use
these in an intelligent way. We should have conventions, as Java does,
that let you see immediately that you are looking at an object
reference, public method, etc.
There are no private methods, so we don't need method names that start
with underscores.
>
For what it's worth, 6 conventions say JavaScript, one says
Javascript. None use anything else.
JavaScript refers to a specific implementation, but is often used to
refer to all ECMAScript (like Coke is sometimes used to describe all
cola.)
Oct 31 '08 #2

P: n/a
On Oct 31, 2:29*pm, Martin Rinehart <MartinRineh...@gmail.comwrote:
I asked Google for "javascript code conventions". He pointed me to
seven convention documents. (More exactly, to Crockford and six lesser
convention documents.) I have compiled all the conventions in a single
document, here:

http://www.martinrinehart.com/articl...nventions.html

I stress that these are NOT my conventions; this is a compilation of
the others. My job: clerk. I tried to be a good clerk, organizing
sensibly so you can find things easily. Not always easy in a field
descended from Sun's Java conventions.

I was frankly disappointed to see that from all the available naming
styles (UpperAndLower, lowerAndUpper, ALLCAPS,
lower_with_underscores, ...) JavaScripters do almost nothing to use
these in an intelligent way. We should have conventions, as Java does,
that let you see immediately that you are looking at an object
reference, public method, etc.

For what it's worth, 6 conventions say JavaScript, one says
Javascript. None use anything else.

I'd like this thread to stick to the document (fixes, documents I
should include, ...) If you want to argue for or against particular
issues, please focus on the issue in a separate post. I'll set things
off in my next post.
Nice to see everything in one place. I fixed some of the links in the
document
I wrote so many years ago. I'll try to give it some more love given I
have more
to share 3 years later.

-Greg
Nov 1 '08 #3

P: n/a
On Oct 31, 2:29*pm, Martin Rinehart <MartinRineh...@gmail.comwrote:
I asked Google for "javascript code conventions". He pointed me to
seven convention documents. (More exactly, to Crockford and six lesser
convention documents.) I have compiled all the conventions in a single
document, here:

http://www.martinrinehart.com/articl...nventions.html

I stress that these are NOT my conventions; this is a compilation of
the others. My job: clerk. I tried to be a good clerk, organizing
sensibly so you can find things easily. Not always easy in a field
descended from Sun's Java conventions.

I was frankly disappointed to see that from all the available naming
styles (UpperAndLower, lowerAndUpper, ALLCAPS,
lower_with_underscores, ...) JavaScripters do almost nothing to use
these in an intelligent way. We should have conventions, as Java does,
that let you see immediately that you are looking at an object
reference, public method, etc.

For what it's worth, 6 conventions say JavaScript, one says
Javascript. None use anything else.

I'd like this thread to stick to the document (fixes, documents I
should include, ...) If you want to argue for or against particular
issues, please focus on the issue in a separate post. I'll set things
off in my next post.
Nice to see everything in one place. I fixed some of the links in the
document
I wrote so many years ago. I'll try to give it some more love given I
have more
to share 3 years later.

-Greg
Nov 1 '08 #4

P: n/a
David Mark wrote:
What field is descended from Sun's Java conventions?
The JavaScript convention document field.

Crockford credits Sun's Java conventions explicitly. Two of the
"following" six credit Crockford explicitly.
Nov 1 '08 #5

P: n/a
Greg Murray wrote:
Nice to see everything in one place. I fixed some of the links in the
document
I wrote so many years ago. I'll try to give it some more love given I
have more
to share 3 years later.
Welcome, Greg Murray.

3 years later and you're still Google top 10. Congrats.

Are you still odd man out re indenting function blocks?

Martin
Nov 1 '08 #6

P: n/a
Greg Murray wrote:
I fixed some of the links
I see that includes the Dojo link. Wow! That's a serious, major
conventions document. Lotta meat on those bones. I'll add it soon as I
get a chance. Many thanks.

Martin
Nov 1 '08 #7

P: n/a
Martin Rinehart wrote:
David Mark wrote:
>What field is descended from Sun's Java conventions?

The JavaScript convention document field.
Pardon?
Crockford credits Sun's Java conventions explicitly. Two of the
"following" six credit Crockford explicitly.
You are not making any sense. I suggest you stop falling for
self-proclaimed gurus (even Crockford can be wrong) and start thinking for
yourself. Then it will become easier for you to formulate understandable
statements.

BTW, since when is Google a "he"?
PointedEars
--
realism: HTML 4.01 Strict
evangelism: XHTML 1.0 Strict
madness: XHTML 1.1 as application/xhtml+xml
-- Bjoern Hoehrmann
Nov 2 '08 #8

P: n/a


Thomas 'PointedEars' Lahn wrote:
You are not making any sense. I suggest you stop falling for
self-proclaimed gurus (even Crockford can be wrong)
Maybe that was too fast. Crockford and another JavaScript convention
directly credit Sun's Java conventions document as their starting
point. Two other JS conventions credit Crockford's conventions
document as being their starting point. The Sun document is poorly
organized (or not really organized at all). That was a gentle jab at
Crockford's lack of visible organization.
BTW, since when is Google a "he"?
My poetic license is current, paid through year end.

Martin
Nov 3 '08 #9

This discussion thread is closed

Replies have been disabled for this discussion.