3 ms·
I prefer the one who takes a dedicated line for the `{`. It leaves me the ability to group together chunks of related functionality, whereas the latter method t
by Fifer82 10y ago
I prefer the one who takes a dedicated line for the `{`. It leaves me the ability to group together chunks of related functionality, whereas the latter method throws out that option instantly.
- lisper 10y agoHuh??? Can you please elaborate on that? Because that makes no sense to me at all.
- deleted 10y ago[deleted]
- bryondowd 10y agoIf all { and } are on their own lines, then it modestly simplifies the ability to visually scan from one to its match because they appear on the same column with nothing between them.
- lisper 10y agoBut if your code is properly indented then you can do the same thing with the first character in the line containing the open brace: if (foo) { | blah; | blah; | blah; | blah; | blah; | blah; | blah; | blah; | blah; }
- Fifer82 10y agoI honestly think it may just be something physical in the brain! That style, especially in other languages with callback hell, feels tight. I can't breathe... That feeling of can't breathe is far far more of a potent dagger in the heart, than simply scrolling one extra mouse wheel in a Class. The open and airy, instantly identifiable shape of the code is just like the fresh sea air. An old friend at work used to call that style "NotepadOpenBinaryFileStyle". The reason that stuck with me was due to its accuracy!
- lisper 10y agoHeh, I have a similar visceral reaction to the "open" style: what a waste of precious screen real estate. Now my eyes have to scan a much bigger area in order to see all the relevant information, and I might even have to waste time scrolling around to find what I'm looking for that I would not have had to if only all that unnecessary white space were eliminated. Putting the brace on the same line also makes it easier to grep for function definitions. So why not: if ( x>y ) { code; ... } } (I've actually seen that in real code.)
- adekok 10y agoThis is a religious war. :( For me, having a screen full of (mostly) blank lines containing { and } is terrible. It means that the information density of the screen is low, to the point of being useless.