Loading ...
Sorry, an error occurred while loading the content.

Maximum line lengths

Expand Messages
  • Chris
    Code can become difficult to read if it goes on for too long without a line break. This most obviously becomes a problem as soon as it becomes necessary to
    Message 1 of 9 , Oct 1, 2009
    • 0 Attachment
      Code can become difficult to read if it goes on for too long without a line break. This most obviously becomes a problem as soon as it becomes necessary to scroll horizontally, but I find that readability actually becomes affected well before that.

      I find that code is cleaner and more understandable if care is taken that no lines exceed 80 - 100 characters in length.

      I suggest that JSLint include an option that would produce a warning message when a line exceeds a certain length (including comments). The specific length in question would probably need to be a user preference, similar to how the indentation setting works. I am sure many people have differing opinions on how long is "too long." I personally prefer 80 characters.
    • Paul Novitski
      ... I respectfully disagree. There is no such thing as an ideal line length for the masses. The individual user determines the browser window width, the text
      Message 2 of 9 , Oct 1, 2009
      • 0 Attachment
        At 10/1/2009 03:01 PM, Chris wrote:
        >Code can become difficult to read if it goes on for too long without
        >a line break. This most obviously becomes a problem as soon as it
        >becomes necessary to scroll horizontally, but I find that
        >readability actually becomes affected well before that.
        >
        >I find that code is cleaner and more understandable if care is taken
        >that no lines exceed 80 - 100 characters in length.
        >
        >I suggest that JSLint include an option that would produce a warning
        >message when a line exceeds a certain length (including
        >comments). The specific length in question would probably need to
        >be a user preference, similar to how the indentation setting
        >works. I am sure many people have differing opinions on how long is
        >"too long." I personally prefer 80 characters.


        I respectfully disagree. There is no such thing as an ideal line
        length for the masses. The individual user determines the browser
        window width, the text display size and font, and, in most text
        editors I've used, the line wrap toggle. Also, line length warning
        messages would likely be merely irritating for the users of
        visually-assistive user agents such as audio and Braille readers.

        If such a feature were added to jslint, I would hope that its default
        would be off and that each user would set that "certain length"
        rather than it being determined by Douglas or anyone else.

        Regards,

        Paul
        __________________________

        Paul Novitski
        Juniper Webcraft Ltd.
        http://juniperwebcraft.com
      • Chris
        ... Yes, of course. Did I not cover that? I specifically suggested an option (that could be turned off--all options are off by default), and suggested that
        Message 3 of 9 , Oct 1, 2009
        • 0 Attachment
          --- In jslint_com@yahoogroups.com, Paul Novitski <paul@...> wrote:
          > I respectfully disagree. There is no such thing as an ideal line
          > length for the masses. The individual user determines the browser
          > window width, the text display size and font, and, in most text
          > editors I've used, the line wrap toggle. Also, line length warning
          > messages would likely be merely irritating for the users of
          > visually-assistive user agents such as audio and Braille readers.
          >
          > If such a feature were added to jslint, I would hope that its default
          > would be off and that each user would set that "certain length"
          > rather than it being determined by Douglas or anyone else.

          Yes, of course. Did I not cover that? I specifically suggested an option (that could be turned off--all options are off by default), and suggested that the "certain length" should be a user preference, similar to the user preference for indentation amount. I do not see how this differs from what you say you disagree with?

          As I have never experienced coding while using assistive technology, I cannot fathom how such an option would affect the experience. However, I maintain that it would be of benefit to sighted users.

          Thanks!
          - Chris
        • Paul Novitski
          ... You re right, you covered it; I read (and reacted) too quickly. My apologies, Paul
          Message 4 of 9 , Oct 1, 2009
          • 0 Attachment
            At 10/1/2009 03:39 PM, Chris wrote:
            >Yes, of course. Did I not cover that? I specifically suggested an
            >option (that could be turned off--all options are off by default),
            >and suggested that the "certain length" should be a user preference,
            >similar to the user preference for indentation amount. I do not see
            >how this differs from what you say you disagree with?

            You're right, you covered it; I read (and reacted) too quickly.

            My apologies,
            Paul
          • pauanyu
            ... Excellent idea! Some computer systems (mostly text-only) are incapable of displaying lines that are longer than 80 characters. Rather than wrapping, they
            Message 5 of 9 , Oct 2, 2009
            • 0 Attachment
              --- In jslint_com@yahoogroups.com, "Chris" <Nielsen.Chris@...> wrote:
              >
              > Code can become difficult to read if it goes on for too long without a line break. This most obviously becomes a problem as soon as it becomes necessary to scroll horizontally, but I find that readability actually becomes affected well before that.
              >
              > I find that code is cleaner and more understandable if care is taken that no lines exceed 80 - 100 characters in length.
              >
              > I suggest that JSLint include an option that would produce a warning message when a line exceeds a certain length (including comments). The specific length in question would probably need to be a user preference, similar to how the indentation setting works. I am sure many people have differing opinions on how long is "too long." I personally prefer 80 characters.
              >

              Excellent idea! Some computer systems (mostly text-only) are incapable of displaying lines that are longer than 80 characters. Rather than wrapping, they will truncate anything past the 80th character.

              That is at least one good reason to include this option. I am also in favor of making it user-selectable, as some would have different preferences.
            • Michael Lorton
              People who use systems limited to 80 characters don t need JSLint because they are living in 1987 and Javascript hasn t been invented yet. The reason to limit
              Message 6 of 9 , Oct 2, 2009
              • 0 Attachment
                People who use systems limited to 80 characters don't need JSLint because they are living in 1987 and Javascript hasn't been invented yet.

                The reason to limit line length is not for the display -- it's for readability. Humans don't process big chunks of text that well. Limit lines to 80 characters, maybe 100 at the most, and limit functions to 20 lines, 40 at the most, so that other people can figure out your code. (Whether JSLint should be the thing that enforces that limit is another question.)

                M.




                ________________________________
                From: pauanyu <pcxunlimited@...>
                To: jslint_com@yahoogroups.com
                Sent: Friday, October 2, 2009 5:24:59 AM
                Subject: [jslint] Re: Maximum line lengths



                --- In jslint_com@yahoogroups.com, "Chris" <Nielsen.Chris@...> wrote:
                >
                > Code can become difficult to read if it goes on for too long without a line break. This most obviously becomes a problem as soon as it becomes necessary to scroll horizontally, but I find that readability actually becomes affected well before that.
                >
                > I find that code is cleaner and more understandable if care is taken that no lines exceed 80 - 100 characters in length.
                >
                > I suggest that JSLint include an option that would produce a warning message when a line exceeds a certain length (including comments). The specific length in question would probably need to be a user preference, similar to how the indentation setting works. I am sure many people have differing opinions on how long is "too long." I personally prefer 80 characters.
                >

                Excellent idea! Some computer systems (mostly text-only) are incapable of displaying lines that are longer than 80 characters. Rather than wrapping, they will truncate anything past the 80th character.

                That is at least one good reason to include this option. I am also in favor of making it user-selectable, as some would have different preferences.



                ------------------------------------

                Yahoo! Groups Links



                [Non-text portions of this message have been removed]
              • Dominic Mitchell
                ... I find most printers only really do 80 columns well. If you wrap, it gets unreadable very quickly. ... I ll add a +1 for an optional warning for this.
                Message 7 of 9 , Oct 2, 2009
                • 0 Attachment
                  On Fri, Oct 2, 2009 at 7:15 PM, Michael Lorton <mlorton@...> wrote:

                  > People who use systems limited to 80 characters don't need JSLint because
                  > they are living in 1987 and Javascript hasn't been invented yet.
                  >

                  I find most printers only really do 80 columns well. If you wrap, it gets
                  unreadable very quickly.


                  > The reason to limit line length is not for the display -- it's for
                  > readability. Humans don't process big chunks of text that well. Limit
                  > lines to 80 characters, maybe 100 at the most, and limit functions to 20
                  > lines, 40 at the most, so that other people can figure out your code.
                  > (Whether JSLint should be the thing that enforces that limit is another
                  > question.)
                  >

                  I'll add a +1 for an optional warning for this. Whilst I don't think it's
                  something to enforce on everybody, it can be a useful tool as part of a
                  local standard.

                  -Dom


                  [Non-text portions of this message have been removed]
                • Michael Newton
                  From: Michael Lorton ... You ve clearly never edited outside the comfort of your GUI! This is a problem for me when I SSH into a remote
                  Message 8 of 9 , Oct 2, 2009
                  • 0 Attachment
                    From: Michael Lorton <mlorton@...>
                    >People who use systems limited to 80 characters don't need JSLint because they are living in 1987 and Javascript hasn't been invented yet.

                    You've clearly never edited outside the comfort of your GUI! This is a problem for me when I SSH into a remote machine and have to use nano to look at code. (No, I'm not cool enough to use vi or emacs.) This seems like a useful option for some, obviously it would be disabled by default just like the strict whitespace option.


                    __________________________________________________________________
                    Make your browsing faster, safer, and easier with the new Internet Explorer® 8. Optimized for Yahoo! Get it Now for Free! at http://downloads.yahoo.com/ca/internetexplorer/
                  • Stefan Weiss
                    ... Just for the record - neither vi, emacs, nano, or Unix terminals put any restrictions on line length. If you use PuTTY (or some other terminal emulator) to
                    Message 9 of 9 , Oct 3, 2009
                    • 0 Attachment
                      On 03/10/09 01:09, Michael Newton wrote:
                      > From: Michael Lorton <mlorton@...>
                      >> People who use systems limited to 80 characters don't need JSLint
                      >> because they are living in 1987 and Javascript hasn't been invented yet.
                      >
                      > You've clearly never edited outside the comfort of your GUI! This is a
                      > problem for me when I SSH into a remote machine and have to use nano to
                      > look at code. (No, I'm not cool enough to use vi or emacs.) This seems
                      > like a useful option for some, obviously it would be disabled by default
                      > just like the strict whitespace option.

                      Just for the record - neither vi, emacs, nano, or Unix terminals put any
                      restrictions on line length. If you use PuTTY (or some other terminal
                      emulator) to SSH to the server, you can just resize your window or tell
                      the terminal emulator how wide you want your lines. The old "hard" 80
                      char limit is really an anachronism, GUI or not.

                      That said, source lines can become too long to read comfortably, and
                      "maxlen" it is a very useful new option in JSLint. I'm definitely going
                      to use it.


                      cheers,
                      stefan


                      --
                      LOAD"Ph'nglui mglw'nafh Cthulhu R'lyeh wgah'nagl fhtagn!",8,1
                      RUN!
                    Your message has been successfully submitted and would be delivered to recipients shortly.