JavaScript Convention Documents

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Martin Rinehart

    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:



    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_unde rscores, ...) 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.
  • David Mark

    #2
    Re: JavaScript Convention Documents

    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:
    >

    >
    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_unde rscores, ...) 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.)

    Comment

    • Greg Murray

      #3
      Re: JavaScript Convention Documents

      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:
      >

      >
      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_unde rscores, ...) 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

      Comment

      • Greg Murray

        #4
        Re: JavaScript Convention Documents

        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:
        >

        >
        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_unde rscores, ...) 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

        Comment

        • Martin Rinehart

          #5
          Re: JavaScript Convention Documents

          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.

          Comment

          • Martin Rinehart

            #6
            Re: JavaScript Convention Documents

            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

            Comment

            • Martin Rinehart

              #7
              Re: JavaScript Convention Documents

              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

              Comment

              • Thomas 'PointedEars' Lahn

                #8
                Re: JavaScript Convention Documents

                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

                Comment

                • Martin Rinehart

                  #9
                  Re: JavaScript Convention Documents



                  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

                  Comment

                  Working...