re: What’s an unpopular software opinion you have? VIEW POST

TOP OF THREAD FULL DISCUSSION
re: A left curly bracket that marks the start of a code block should be placed on a new line.
 

C# or JavaScript? C# I agree. JavaScript no, why!!!

 

I'm the same - some languages are fine with it on new lines, some are strange.

Most importantly though is that you are consistent. Don't be like PHP PSR-1 and have classes and functions one way but if/for/while etc another.

 

Any language using curly brackets for code blocks. Simply because with a new line the left and right curly brackets align, oh the beauty of alignment!
But your opinion must be even more unpopular, that you prefer new line in one language and not the other.

It's the way I learned each language and I think most of the JS I work on has enforced linting.

I had a colleague who was putting the curly bracket on the same line, for compactness, but then was starting the code block with an empty line, for readability.

I used to like my brackets to match, but lint disagrees and so do most programmers. I have my principles, and if you don't like them, well ... I have others. Life is full of disappointments and sometimes it's easier just to go with the flow.

code of conduct - report abuse