41

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

Comments
  • 8
    { on new lines is a totally great reason to break up with her.

    Also no curly braces around if statements.

    Instant go to break
  • 8
    @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.
  • 2
    @arvindprakash

    if ( 1 + 1 == 2 );
    {
    //this wont happen
    }
  • 5
    @C0D4 that comment thing will happen though because of the semicolon.
  • 2
    haha i see what i did wrong there.

    if( 1+1 != 2);
    {
    // this will still run
    }
  • 2
    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.
  • 3
    @ElGamerBroChris i did that too till I switched to the same line. Makes it way clearer to me.
  • 4
    @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.
  • 0
    @arvindprakash I guess you learnt that from the coding style of your text book. (I did) :P
  • 2
    She should use spaces instead of tabs. Or convert tabs to spaces. Tab is scary.
  • 1
    @@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.
  • 1
    Richard Hendrix, is that you? 😄
  • 1
    Curly 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.
  • 1
    I 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.
  • 0
    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.
  • 1
    Spaces? Oh my god...
  • 1
    @allibragi Wtf you're copying my avatar
  • 1
    Is that you Richard Henericks :p
Add Comment