Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
With me it's usually more of a 120-column suggestion, if it is what I think it is :P
-
devTea240885y@R1100 @AleCx04 code only get to 80 col long and get break into new line if more than that
I think the idea is to support multi screen coding -
C0D4681465y@AleCx04 one of those coding style rules. Where lines should not exceed 80 characters.
If they do you break them up into multiple lines
If( some_huge && ass_condition ) {}
Would turn into
If (
Some_huge &&
ass_condition
){}
Just imagine those being really long lines each -
irene33945yI set project linting rules to soft wrap long lines and use tabs for the projects I start.
If the line is an array of precalculated values or a string constant let it be.
If there is too much going on in a line and it is unruly it should get knocked down in code review. If a line is that long it probably should have commenting explaining why the logic is like that. Minimize terse lines.
I think that the number 80 goes back to number of holes in an IBM punch card. It matters for tradition and if you need to print. Though new editors and IDEs can’t even print. CTRL+P is find a file in the project in VS Code. -
Wack63115yNo, we don't do that nowadays. However, depending on what language you're using, this might be a Hard requirement
If you're using a mildly recent IDE, you should bei able to configure it to add (or hide) a linebreak at your convinience...
Short answer: no, Long answer: your IDE's lying, but if you got to know the trutht, my IDEs Tab Setting would instantly switch to 6 spaces, so to prevent this, I can't tell you! -
I try to keep my lines short, but from time to time I write longer than 80 characters. Generally conditions can be long.
-
iAmNaN71315yBecause you never know when you'll be using a VT that is limited to 80 char width. Also, many CLI are limited to 80 chars, because they were designed for VT's. When I say VT, I'm taking about the old yellow or green text CRT's of the last. That is why that rule exists.
-
kleopi8735ymy ide enforces it, but it sometimes hurts more than it helps...
also my ide doesnt get that factory patterns are better when statements are blocks... -
I use 80 col as a soft rule so I won't break a line if it's only say 3 characters past, but if it's more than 10 it'll get broken up
-
sysvinit8585yYes in most cases, imo reading two lines seems easier than one long line of code with horizontal scrolling.
Also when I write markup languages, JS, I write with 2 spaces indentation. -
@r4ndsen Still people might need to merge a diff in a terminal. Long lines can be really annoying there.
-
I'd also add in that source files should not have more than 1 kB length so that in addition to a prehistoric terminal, you can also use a 300 baud acoustic modem comfortably.
-
smirving925y@Wack Actually tons of people do actually do that nowadays. 80 columns limit is in the Google style guide along with most every other comapny's style guide I've ever read. If makes reading the code much easier (it has been shown that people have an easier time reading lines between 80 and ~110 characters and a line limit makes it much easier to read when debugging. Plus you can then have two files up at once next to each other on the same screen.
Setting a character limit ensures you won't have to scroll sideways, which is universally despised.
Saying no one uses a character limit anymore is flat out wrong.
Personally I have a default line length of 80 with the exception being some things like URLs. Inline comments I let go to a char limit of 110. For HTML I use a char limit of 110 with an inline comment limit of 120.
It is not hard at all to implement this standard given things like Prettier and Beautify, and I also just keep a margin line visible in my editor at 80, 110, and 120. -
smirving925y@Krokoklemme 80 is plenty of space for everything except the occasionally exception like base64 dataURI or URLs or online comments or HTML. The limit enhances readability which is a big reason it is in most corporate style guides.
-
740027805yIn C yes, strictly. For other languages, I use the default style guide's/formatter's column limit.
Shorter lines are easier to skim and allow for multiple files next to each other. Additionally, I dislike both horizontal scrolling and automatic linebreaks in code. -
Root825085yDepends on what it's doing.
I try to keep everything short and easy, but sometimes there is no way around longer (100 char) lines, and breaking them up can reduce legibility. Especially if there are multiple similar lines; vertically aligning their pieces makes them much easier to read and understand. -
irene33945y@7400 Once an automatic line break is put in it had to be manually removed. If that isn’t a reason to avoid automatically breaking lines I don’t know what is.
-
Koolstr27905yYes I use it all the time. It sure as hell is easier, faster, and more convenient to read and edit multiple formatted lines than to side scroll through a shit storm of code.
Sadly where I worn there are pockets of code where multiple long statements are on a single line and its frustrating as hell. Thank God our IDEs have word wrap, but do you know how irritating it is to try to diff code in Subversion that is all on one line?
I tried implementing 80 column auto formatting there but my coworkers were annoyed by it in a lot of cases. Raising it to 110 columns left them more satisfied than not. -
b3b343775yI always do. I can't stand people not reacting the 80col rule. Having to scroll to the right only because a line has > 80cols sucks. It's annoying to read
-
joas19425yThough, I noticed today that when I write markdown with 80 column rule, it didn't flow very well on web applications like in our task management.
-
I generally try to keep it under 100. For most of my code, say 500 lines, only about 10-12 will be past 100 nearing 105-110
-
Partially Because resharper kinda does it for you automatically. However I increased the wrap to 200 because I use a 4k screen.
-
If people follow the 80col guideline, you can fit 3 terminals of code in a regular 16/(9/10) aspect ration screen. On ultra-wide 5 blocks! It still has its advantages.
-
I have bad vision so I use large font on my laptop, which basically makes the editing panel about that wide. I use the 80cols rule, I even write it in style guides if I can. I can probably forgive most style issues, but if I start seeing horizontal scrollbars one of us will leave the project soon.
-
@irene It wraps to col 0, and even if it didn't, it still wraps at the weirdest places. I usually have a clause along the lines of "If breaking the line up while maintaining meaningful variable names isn't possible, insert a line feed after an opening bracket or a ternary operator."
-
i respect the "lines should not outrun the width my window has when showing two files side by side (on a single monitor)" rule.
Does anyone respect the 80 columns rule when coding?
question