39

Let's have a real debate.

Not Linux vs Windows vs Mac.

Not Vim vs Emacs.

Not ASP.NET vs Spring Frameworks.

NO.

CHARACTER LIMIT. 80, 100, or 120+ and WHY.

Comments
  • 8
    I do 100 limit because screw old punch card standards. Nobody uses them anymore and I need the SPACE.
  • 9
    I like 80 because I like to have files open side by side in vim without lines wrapping. No other good reason though.
  • 4
    128. Because obvious reasons.
  • 2
    Notepad++ vertical guide at 82, no line wrap, show characters on
  • 4
    100 because 80 doesn't fit some lines or complex declarations.

    Also anything past ~110 is just getting too long.
  • 3
    Shoot for 80, but hard limit at 100.
  • 7
    86.53 because I don't like whole numbers
  • 1
    Screen widht, how many that may be.
  • 2
    Whatever the width is when I have navigation and other panels open on the left and right side of the editor. Think about Intellij and visual studio. Usually it comes down to 120 (27" monitor).
  • 3
  • 1
    Just kidding, I aim for about 100, 120 being a hard limit.
  • 2
    Speaking about java.. I prefer 120-140.
  • 1
    80 'cause it makes people use typedef in c++ for commenly used types like a smart pointer to a class.

    reduces
    std::shared_ptr<MyClass> ptr;
    to
    MyClass::ptr_t;
  • 1
    Depends on language. For Java 120 for me. I don't think this matter that much, most IDEs can reformat code to your preference anyway.
  • 2
    No fans of everything on a single line?

    Seriously though: About 80, not more than 2 levels of indentation, and I try to stick to a 20-10-10 rule as well: 20 lines per method, 10 methods per class, 10 classes per "module".

    Roughly.

    I hate hard CI-enforced limits on any of it though, sometimes code is easier to read on a single line, sometimes methods should be 50 lines because it really doesn't make sense to abstract things away.
  • 5
    200 so I can use long and intuitive function names like shouldBathroomTripBeScheduledAfterLunchBecauseYouDrankCoffee()
  • 1
    For Java I use 80, with a 10 size font. Means I can have to windows with code open side by side, and I don't have to be madly switching between a couple. And if I run the 80 limit, split the declaration into a couple lines.

    Looks neater, except when it's a 2 line if statement... Those are kinda ugly...
  • 3
    On one hand, PEP 8 mandates a 79 characters.

    On the other hand, PyCharm allows 120 characters.

    But I'm a practical programmer, so I don't adhere to strict rules over just doing what's right.

    And I'm not about to make something weird like cutting a http link in half just to respect rules made in an ancient time where a terminal would only display 80 characters.

    I still try to keep things under 120 characters, but if a line takes 125 or 130, so be it.
  • 2
    120 because JSX
  • 2
    Set the font to arial so you can fit more characters on a line 😉😌😂
  • 0
    is that really a thing? I don't care about the limit, I care about being able to read the damn code. If the line is too long either I'm doing something wrong or that IF statement can be broken down to either multiple lines or just rewrite my conditions in-case applicable I just never care about that grey vertical line Android Studio shows ...
  • 1
    I have to do 80 with RPG, which annoys me; So I usually use 128 when I can, feels like freedom to me.
  • 0
    I usually aim for 80 but some lines just require more. So 90 is usually a hard max for me.
  • 0
    @bittersweet we have someone who writes SQL like that; all queries are three lines:

    SELECT ....
    FROM ....
    WHERE ...

    No matter what else is added; CASE, JOIN, GROUP BY, it is always three lines.
  • 2
    @bkwilliams WTF! He should be forbidden to write queries -.-
  • 0
    I do 79!

    79 is for ensuring that it can be displayed on very old machines. Also, in modern landscape monitors you can put up to 3 terminal windows, effectively doing a 3way diff properly.

    If you have a hbig enough screen you can even put two terminals this way in portrait orientation

    79
Add Comment