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
-
{ on new lines is a totally great reason to break up with her.
Also no curly braces around if statements.
Instant go to break -
@nickhh I use { on a new line sir.It improves readability to the code.Give me one reason why I should not use this style.
-
I do the braces thing too, used to be the other way around but a professor told me why he does that and it makes more sense. It allows you to see the beginning and end easily.
-
@ElGamerBroChris i did that too till I switched to the same line. Makes it way clearer to me.
-
@arvindprakash because it's silly waste of white space. Pushes the code down an extra line and you end up seeing less of it in the viewport (the viewable screen are), so you have to scroll more, not less.
-
@arvindprakash I guess you learnt that from the coding style of your text book. (I did) :P
-
@@Faraaz yeah, I did and after sometime I shifted to K&R style of coding which involved me to "not waste whitespaces" and hence I tried it but the only reason I found why people prefer it (a logical reason) is because the codebase is written in that style (even the Linux kernel is written in that style) so I used the way where we write code like this
While( Foo == 2) {
//Some code
}
But other than maintaining the style just because it is how it has been done , I don't find a valid reason.
But the Allman's coding style made sense.The code looks clean and everybody loves a clean code.I don't think whitespaces really matter in the larger picture because there are more extremely interlocked coding styles like
If(Foo == 2){
//Some code}
I really want to find a reason to stick to K &R's style because I work in kernel and it is written like that. -
Lightor7827yCurly brace new line, every time. Way easier to read and match em up. I'd take having to scroll one extra line for more readable code any day.
-
SSDD47977yI don't put { on a new line but having been reading colleagues code who does this and I do think it's more readable. I may switch.
-
Fun-fact: Developers who use spaces consistently earn more than those who use tabs. That's why I switched.
Putting the { on a new line probably makes more readable code, so yeah. Haven't tried it myself, probably should.
So my ex gf was a developer too and she used spaces instead of tabs and she would put the { on a new line. That was not the reason to break up with her but I just can't hold my rage ffs
undefined