473,394 Members | 1,787 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

JavaScript Convention Documents

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
8 2753
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
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
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
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
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
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
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


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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
by: Charlene Russ | last post by:
Learn on-line at your own convenience in a user-centered format with plenty of interaction and personal attention. This is a basic level coursed designed to introduce the novice to intermediate...
3
by: Joey | last post by:
Can someone provide an example of how to link in a javascript source file into the master page of my asp.net 2.0 web application? In asp.net 1.1 I always used the following line of code in each...
24
by: Aaron Gray | last post by:
From what I have been looking at for Javascript library development, browsers that support Javascript 1.5/ECMAScript 3/JScript 5.5 looks like the base level to pitch at. Anyone add anything ? ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.