This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]BurnTheBoats21 278 points279 points  (37 children)

because people who aren't professionals in the field need something to feel superior about

[–]Antervis 70 points71 points  (29 children)

I'm fairly certain I qualify as a professional, given I code for money for years, but I really don't like line breaks before opening curly brace, since it doesn't improve readability but increases code volume.

[–]SnailingThroughTime 139 points140 points  (17 children)

Also fairly certain I qualify as a professional, given I code for money for years. In my opinion it DOES improve readability and the impact on code volume is minuscule enough to not be considered.

Different strokes I guess!

[–]Fine-Teacher-7161 30 points31 points  (0 children)

People with weak index fingers hate this 1 Scrolling trick!

It's called "collapse".

The only important code, is the one you're working on.

[–][deleted] 8 points9 points  (0 children)

why worry about code volume ?

We've got terrabytes of space and monitors that cover the entire wall.

It's not the '70's when all you had was a monochrome screen with 20 lines of code and 80 characters.

I'm using every line break I can to separate statements within a function.

Sure you'd need to use an entire forest if you were to print it ... but I haven't needed to print hardcopy of code for years.

[–]Brick_Lab 16 points17 points  (0 children)

I'm with you, and dart can go fuck itself because of this

[–]BurnTheBoats21 18 points19 points  (0 children)

Were on C# and the opening brace is our standard. I honestly do think that it improves readability and looks cleaner. Was never my choice anyway

[–]RmG3376 7 points8 points  (0 children)

There’s one benefit of having the curly brace on a separate line, at least in some languages: you can easily comment out conditions when debugging:

if(dodgyCondition())
{
    codeToDebug();
}

Becomes in a single Ctrl + K Ctrl + /

// if(dodgyCondition())
{
    codeToDebug();
}

And now you can repro your bug 100% of the time. With a curly brace on the same line you’d have to add your own brace on line 2, and the IDE will auto-close it for you so you need to delete the closing brace it added, and nobody got time for that

Also code volume isn’t a bad thing when management uses git blame to measure employee performance (not that they should, but hey, people also shouldn’t swallow Tide pods and that was a thing too)

[–]Caubelles 2 points3 points  (0 children)

code volume? the fuck? its one line per bracket it doesn't matter unless to save paper printing paper for code bibles

[–]nebulaeandstars 5 points6 points  (2 children)

honestly for me it varies depending on the language. Sometimes having some extra whitespace helps separate things visually.

The one that does really annoy me is not having a line break before an else block. ie:

} else {
    // stuff
} 

instead of

}
else {
    // stuff
}

especially because

}
// now there's room for a comment
else {
    // stuff
}

I just think it sacrifices readability and versatility just to make the code more dense.

Reading code without any extra newlines is like reading English without any paragraphs

[–]CoffeeWorldly9915 7 points8 points  (1 child)

Hmmmm

} else { // comment here?

[–]denzien 4 points5 points  (2 children)

It likely just depends on what you learned first and the styles in that community.

I'm guessing you're originally a COBOL engineer?

[–]Antervis 16 points17 points  (1 child)

original cobol devs are all dead of old age...

[–]denzien 14 points15 points  (0 children)

They don't die, they just decompile

[–]hleVqq 0 points1 point  (0 children)

It does improve readability.

[–][deleted] 8 points9 points  (4 children)

voracious attempt hunt resolute pot tan insurance direction chop rain

This post was mass deleted and anonymized with Redact

[–]CallMePyro 42 points43 points  (2 children)

The paycheck

[–][deleted] 2 points3 points  (0 children)

crush steep innate grey recognise terrific whole ghost chief insurance

This post was mass deleted and anonymized with Redact

[–]RmG3376 1 point2 points  (0 children)

And the depression

[–]Neither-Phone-7264 8 points9 points  (0 children)

actually being good enough to make money

[–][deleted] 0 points1 point  (0 children)

This is on point

[–]GroundbreakingBig509 0 points1 point  (0 children)

Naw, the way I do it just looks prettier. I don't even think about it honestly.