Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. No your line is too long.

No your line is too long.

Scheduled Pinned Locked Moved The Lounge
comquestionannouncement
45 Posts 20 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    jschell
    wrote on last edited by
    #1

    From CP newsletter https://www.codeproject.com/News.aspx?ntag=19837497829658814&_z=2928472[^] They want to run their monitors in a diagonal mode because? "Why 22 degrees? At that angle, you get the longest line length (stretching between opposite corners)" My answer to that - your line is too long. Make it shorter. You are not writing code for you but are writing it for the people in the future that must maintain it.

    Mike HankeyM P D K T 14 Replies Last reply
    0
    • J jschell

      From CP newsletter https://www.codeproject.com/News.aspx?ntag=19837497829658814&_z=2928472[^] They want to run their monitors in a diagonal mode because? "Why 22 degrees? At that angle, you get the longest line length (stretching between opposite corners)" My answer to that - your line is too long. Make it shorter. You are not writing code for you but are writing it for the people in the future that must maintain it.

      Mike HankeyM Offline
      Mike HankeyM Offline
      Mike Hankey
      wrote on last edited by
      #2

      Not just no but hell no!

      As the aircraft designer said, "Simplicate and add lightness". PartsBin an Electronics Part Organizer - Release Version 1.3.0 JaxCoder.com Latest Article: SimpleWizardUpdate

      1 Reply Last reply
      0
      • J jschell

        From CP newsletter https://www.codeproject.com/News.aspx?ntag=19837497829658814&_z=2928472[^] They want to run their monitors in a diagonal mode because? "Why 22 degrees? At that angle, you get the longest line length (stretching between opposite corners)" My answer to that - your line is too long. Make it shorter. You are not writing code for you but are writing it for the people in the future that must maintain it.

        P Offline
        P Offline
        PIEBALDconsult
        wrote on last edited by
        #3

        At most one line that length. Try a smaller font -- I use 8pt. I also try to limit my line lengths to 112 characters. I used to use VT screens set to 132 characters per line. 132 characters per line ought to be enough for anybody.

        U 1 Reply Last reply
        0
        • J jschell

          From CP newsletter https://www.codeproject.com/News.aspx?ntag=19837497829658814&_z=2928472[^] They want to run their monitors in a diagonal mode because? "Why 22 degrees? At that angle, you get the longest line length (stretching between opposite corners)" My answer to that - your line is too long. Make it shorter. You are not writing code for you but are writing it for the people in the future that must maintain it.

          D Offline
          D Offline
          Dave Kreskowiak
          wrote on last edited by
          #4

          Obviously, this person has never seen how Microsoft writes long lines. For example,

          HRESULT Scene::CreateDeviceDependentResources()
          {
          HRESULT hr = m_pRenderTarget->CreateSolidColorBrush(
          D2D1::ColorF(1.0f, 1.0f, 0),
          D2D1::BrushProperties(),
          &m_pFill
          );

          if (SUCCEEDED(hr))
          {
              hr = m\_pRenderTarget->CreateSolidColorBrush(
                  D2D1::ColorF(0, 0, 0),
                  D2D1::BrushProperties(),
                  &m\_pStroke
                  );
          }
          return hr;
          

          }

          Asking questions is a skill CodeProject Forum Guidelines Google: C# How to debug code Seriously, go read these articles. Dave Kreskowiak

          D 1 Reply Last reply
          0
          • J jschell

            From CP newsletter https://www.codeproject.com/News.aspx?ntag=19837497829658814&_z=2928472[^] They want to run their monitors in a diagonal mode because? "Why 22 degrees? At that angle, you get the longest line length (stretching between opposite corners)" My answer to that - your line is too long. Make it shorter. You are not writing code for you but are writing it for the people in the future that must maintain it.

            K Offline
            K Offline
            k5054
            wrote on last edited by
            #5

            I can understand the motivation. I've seen, and perhaps perpetrated, something like:

            string someString = mything.something().somethingElse().foo().bar().bang().whiz().toString()

            Which can sometimes lead to very long lines. But any decent optimizer should be able to elide otherwise unused intermediate object so maybe

            auto something = mything.something();
            auto foobar = something().foo().bar();
            auto whiz = foobar().bang().whiz();
            string someString = whiz.toString();

            is preferable? But if you're going to keep the long version as a single statement, but write it over separate lines do you prefer putting the . at the end or the start of the line? e.g

            mything.something().
            foo().bar().whiz().
            bang().toString()

            vs

            mything.something()
            .foo().bar().whiz()
            .bang().toString()

            "A little song, a little dance, a little seltzer down your pants" Chuckles the clown

            P O J 3 Replies Last reply
            0
            • J jschell

              From CP newsletter https://www.codeproject.com/News.aspx?ntag=19837497829658814&_z=2928472[^] They want to run their monitors in a diagonal mode because? "Why 22 degrees? At that angle, you get the longest line length (stretching between opposite corners)" My answer to that - your line is too long. Make it shorter. You are not writing code for you but are writing it for the people in the future that must maintain it.

              T Offline
              T Offline
              trønderen
              wrote on last edited by
              #6

              My first job was in an age where graphic terminals were just starting to appear. My employer were designing a screen management library, primarily oriented towards screens with a resolution of 80 by 25 characters. Yet, we wanted the library to be prepared for the graphics of the future. We had a brainstorming to provide input to the requirements spec, coming up with a proposal where the screen could be filled by a sphere. On this globe, you could allocate several virtual screens, as a sector of a given number of degrees from pole to pole. Each virtual screen (i.e. sector) could scroll independently of the others, and you could spin the globe to bring a specific screen towards you. We never agreed which would be the better default: Either, to clip the contents to the 'longitude' edges of the virtual screen (so that you would have to scroll a line to the middle to see its full length), or to scale down towards the poles (so that you would have to scroll to see a line in maximum size). For some reason, this solution has never been realized (to my knowledge). I am quite sure that it would be possible with Linux and this screen driver. There must be someone who thinks that this is a great idea. (In case you wonder: We were not dead serious about it - it was in the same class as 'esoteric' programming languages such as brainfuck or whitespace.)

              Religious freedom is the freedom to say that two plus two make five.

              1 Reply Last reply
              0
              • J jschell

                From CP newsletter https://www.codeproject.com/News.aspx?ntag=19837497829658814&_z=2928472[^] They want to run their monitors in a diagonal mode because? "Why 22 degrees? At that angle, you get the longest line length (stretching between opposite corners)" My answer to that - your line is too long. Make it shorter. You are not writing code for you but are writing it for the people in the future that must maintain it.

                K Offline
                K Offline
                kmoorevs
                wrote on last edited by
                #7

                Get a bigger monitor? Learn how to use a line continuation character maybe? (depending on language options) The only really long lines I ever have are sql queries. In the past, I used to insist on keeping the Select From Group By, and Order By on individual lines and concatenate. Nowadays, I either use line continuations or a string builder to keep everything visible. (horizontally)

                "Go forth into the source" - Neal Morse "Hope is contagious"

                T 1 Reply Last reply
                0
                • K k5054

                  I can understand the motivation. I've seen, and perhaps perpetrated, something like:

                  string someString = mything.something().somethingElse().foo().bar().bang().whiz().toString()

                  Which can sometimes lead to very long lines. But any decent optimizer should be able to elide otherwise unused intermediate object so maybe

                  auto something = mything.something();
                  auto foobar = something().foo().bar();
                  auto whiz = foobar().bang().whiz();
                  string someString = whiz.toString();

                  is preferable? But if you're going to keep the long version as a single statement, but write it over separate lines do you prefer putting the . at the end or the start of the line? e.g

                  mything.something().
                  foo().bar().whiz().
                  bang().toString()

                  vs

                  mything.something()
                  .foo().bar().whiz()
                  .bang().toString()

                  "A little song, a little dance, a little seltzer down your pants" Chuckles the clown

                  P Offline
                  P Offline
                  PIEBALDconsult
                  wrote on last edited by
                  #8

                  I find that dots and commas and such are easier to see at the start of a line. I put commas and binary operators (not dots) on their own lines in many cases so they really stand out.

                  1 Reply Last reply
                  0
                  • K kmoorevs

                    Get a bigger monitor? Learn how to use a line continuation character maybe? (depending on language options) The only really long lines I ever have are sql queries. In the past, I used to insist on keeping the Select From Group By, and Order By on individual lines and concatenate. Nowadays, I either use line continuations or a string builder to keep everything visible. (horizontally)

                    "Go forth into the source" - Neal Morse "Hope is contagious"

                    T Offline
                    T Offline
                    trønderen
                    wrote on last edited by
                    #9

                    When our coding standards were revised, the working group proposed to limit line lengths 72 characters of code. Our project manager immediately granted an exemption to this rule: We also had rules for how to make up names for #define constants (identifying module, submodule, function etc. etc.) that resulted in constant names exceeding 80 chars. (Personally, I think that rules that can lead to such results are completely crazy. There are also rules for how to name directories, subdirectories, sub-sub and sub-sub-sub-... directories, so that any directory should be 'self-identifying' even if located in an identifying higher directory. In one case, I counted the same module ID repeated seven times in a complete path string. This naming standard obviously created problems for DOS-friendly file systems with a maximum path length of 260 characters. Even if that 260 char limit sometimes was a pain in the horse, I think that naming rules frequently leading to path strings filling several lines of output are just as crazy!)

                    Religious freedom is the freedom to say that two plus two make five.

                    1 Reply Last reply
                    0
                    • J jschell

                      From CP newsletter https://www.codeproject.com/News.aspx?ntag=19837497829658814&_z=2928472[^] They want to run their monitors in a diagonal mode because? "Why 22 degrees? At that angle, you get the longest line length (stretching between opposite corners)" My answer to that - your line is too long. Make it shorter. You are not writing code for you but are writing it for the people in the future that must maintain it.

                      M Offline
                      M Offline
                      MarkTJohnson
                      wrote on last edited by
                      #10

                      Well, the fact that only Linux supports diagonal orientation says something about the person wanting diagonal orientation. "Too busy seeing if they COULD do it to be bothered with whether they SHOULD do it."

                      I’ve given up trying to be calm. However, I am open to feeling slightly less agitated. I’m begging you for the benefit of everyone, don’t be STUPID.

                      T 1 Reply Last reply
                      0
                      • D Dave Kreskowiak

                        Obviously, this person has never seen how Microsoft writes long lines. For example,

                        HRESULT Scene::CreateDeviceDependentResources()
                        {
                        HRESULT hr = m_pRenderTarget->CreateSolidColorBrush(
                        D2D1::ColorF(1.0f, 1.0f, 0),
                        D2D1::BrushProperties(),
                        &m_pFill
                        );

                        if (SUCCEEDED(hr))
                        {
                            hr = m\_pRenderTarget->CreateSolidColorBrush(
                                D2D1::ColorF(0, 0, 0),
                                D2D1::BrushProperties(),
                                &m\_pStroke
                                );
                        }
                        return hr;
                        

                        }

                        Asking questions is a skill CodeProject Forum Guidelines Google: C# How to debug code Seriously, go read these articles. Dave Kreskowiak

                        D Offline
                        D Offline
                        dandy72
                        wrote on last edited by
                        #11

                        I have zero problem with that. In fact, I'd much rather see a function's parameters being broken by parameter (one per line) rather than 3 on the first line, 2 on the second line, then 4 on the third line, etc. If it has to be broken down, go all the way. Then if a parameter consists of a function call, and that function needs so many parameters of its own that that line becomes long, then break it into multiple lines too, with an extra indentation level. Seems so logical to me.

                        J 1 Reply Last reply
                        0
                        • M MarkTJohnson

                          Well, the fact that only Linux supports diagonal orientation says something about the person wanting diagonal orientation. "Too busy seeing if they COULD do it to be bothered with whether they SHOULD do it."

                          I’ve given up trying to be calm. However, I am open to feeling slightly less agitated. I’m begging you for the benefit of everyone, don’t be STUPID.

                          T Offline
                          T Offline
                          trønderen
                          wrote on last edited by
                          #12

                          In Norwegian slang, 'slanted' is a term for homosexual. Are you referring to something like that? I wasn't aware of any similar slang term in English.

                          Religious freedom is the freedom to say that two plus two make five.

                          M 1 Reply Last reply
                          0
                          • J jschell

                            From CP newsletter https://www.codeproject.com/News.aspx?ntag=19837497829658814&_z=2928472[^] They want to run their monitors in a diagonal mode because? "Why 22 degrees? At that angle, you get the longest line length (stretching between opposite corners)" My answer to that - your line is too long. Make it shorter. You are not writing code for you but are writing it for the people in the future that must maintain it.

                            H Offline
                            H Offline
                            honey the codewitch
                            wrote on last edited by
                            #13

                            I hate long lines. On the show Supernatural the acting head of hell (Satan was otherwise locked up) decided that since inevitably some people enjoyed the various tortures dished out that he would make everyone stand in line for eternity. "Nobody likes waiting in line"

                            Check out my IoT graphics library here: https://honeythecodewitch.com/gfx And my IoT UI/User Experience library here: https://honeythecodewitch.com/uix

                            T B 2 Replies Last reply
                            0
                            • T trønderen

                              In Norwegian slang, 'slanted' is a term for homosexual. Are you referring to something like that? I wasn't aware of any similar slang term in English.

                              Religious freedom is the freedom to say that two plus two make five.

                              M Offline
                              M Offline
                              MarkTJohnson
                              wrote on last edited by
                              #14

                              No, I meant the actual tilted monitor. Some Linux users are elitist looking down their noses at other operating systems, so being able to have a tilted monitor could be another example.

                              I’ve given up trying to be calm. However, I am open to feeling slightly less agitated. I’m begging you for the benefit of everyone, don’t be STUPID.

                              T P J 3 Replies Last reply
                              0
                              • J jschell

                                From CP newsletter https://www.codeproject.com/News.aspx?ntag=19837497829658814&_z=2928472[^] They want to run their monitors in a diagonal mode because? "Why 22 degrees? At that angle, you get the longest line length (stretching between opposite corners)" My answer to that - your line is too long. Make it shorter. You are not writing code for you but are writing it for the people in the future that must maintain it.

                                B Offline
                                B Offline
                                BernardIE5317
                                wrote on last edited by
                                #15

                                to each her own . as for me i utilize word wrap . rules ? nonsense . my one and only rule is it must be easy to understand but no easier .

                                T 1 Reply Last reply
                                0
                                • H honey the codewitch

                                  I hate long lines. On the show Supernatural the acting head of hell (Satan was otherwise locked up) decided that since inevitably some people enjoyed the various tortures dished out that he would make everyone stand in line for eternity. "Nobody likes waiting in line"

                                  Check out my IoT graphics library here: https://honeythecodewitch.com/gfx And my IoT UI/User Experience library here: https://honeythecodewitch.com/uix

                                  T Offline
                                  T Offline
                                  trønderen
                                  wrote on last edited by
                                  #16

                                  honey the codewitch wrote:

                                  I hate long lines.

                                  So you prefer macaroni to spaghetti? :-)

                                  Religious freedom is the freedom to say that two plus two make five.

                                  B 1 Reply Last reply
                                  0
                                  • B BernardIE5317

                                    to each her own . as for me i utilize word wrap . rules ? nonsense . my one and only rule is it must be easy to understand but no easier .

                                    T Offline
                                    T Offline
                                    trønderen
                                    wrote on last edited by
                                    #17

                                    A long time ago, I read about a study - in a printed periodical, so no URL - where a number of test persons were split into two groups and given the same source code to study. One group got it laid out like ordinary prose, the way you would write a plain text? ("If the rain stops, let's go to the beach. Otherwise, let's break a bottle of wine!" in a single line). The other group got the same program laid out "the programming way", with conditions, if- and else-clauses on separate lines, with proper indentations etc. Similar for loops and other constructs. After the test persons had been given a controlled amount of time to study the code, they were to fill in a questionnaire to reveal how well they had understood the program logic. It turned out that those who had read the "prose formatted" program code scored significantly higher than those who had been reading the "program structured" layout. This is so many years ago that the average person still could be expected to read both fiction and non-fiction books. Today, lots of young people never read a novel after the Harry Potter books (which they chose when school required them to pick one novel to read). So maybe the results would be different today, with lots of people inexperienced with extracting meaning unless it is conveyed both in text, semantics highlighted with punctuation and structure mediated through blocks and indentation.

                                    Religious freedom is the freedom to say that two plus two make five.

                                    P G 2 Replies Last reply
                                    0
                                    • M MarkTJohnson

                                      No, I meant the actual tilted monitor. Some Linux users are elitist looking down their noses at other operating systems, so being able to have a tilted monitor could be another example.

                                      I’ve given up trying to be calm. However, I am open to feeling slightly less agitated. I’m begging you for the benefit of everyone, don’t be STUPID.

                                      T Offline
                                      T Offline
                                      trønderen
                                      wrote on last edited by
                                      #18

                                      OK, I certainly follow your line of thought!

                                      Religious freedom is the freedom to say that two plus two make five.

                                      1 Reply Last reply
                                      0
                                      • T trønderen

                                        honey the codewitch wrote:

                                        I hate long lines.

                                        So you prefer macaroni to spaghetti? :-)

                                        Religious freedom is the freedom to say that two plus two make five.

                                        B Offline
                                        B Offline
                                        BernardIE5317
                                        wrote on last edited by
                                        #19

                                        as for me i prefer fettuccini (rice even rather than whole wheat . refined wheat never .)

                                        1 Reply Last reply
                                        0
                                        • M MarkTJohnson

                                          No, I meant the actual tilted monitor. Some Linux users are elitist looking down their noses at other operating systems, so being able to have a tilted monitor could be another example.

                                          I’ve given up trying to be calm. However, I am open to feeling slightly less agitated. I’m begging you for the benefit of everyone, don’t be STUPID.

                                          P Offline
                                          P Offline
                                          PIEBALDconsult
                                          wrote on last edited by
                                          #20

                                          They think they're looking down, but they are actually looking up.

                                          1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • World
                                          • Users
                                          • Groups