13

Today I was trying to convince a colleague that:
fun example(){
if(thing){
//Do something
}
}
Is stupid because it should be
fun example() {
if (thing) {
//Do something
}
}
It's the small things that are the most frustrating

Comments
  • 8
    Install a style fixer in their ide :D
  • 4
    At least the Enter key works. 🙂
  • 4
    @dindin God don't get me started on the enter key. I can't take it when another colleague does this:
    if (thing) {
    // do something
    }
    else {
    // something else
    }
    when it is so much nicer to do
    } else {
  • 9
    My unrequested advice: don't spend too much time and effort worrying about things that make no difference.

    Sure, we all have our preferences. I, for example, hate to have to hit the Shift key, so I would love to never use caps or underscores and name all my variables something-like-this. But then I would be constrained to using only Lisp or Scheme for ever. No other languages I know of support dashes (= minus signs) in variable names. I also have very specific preferences regarding spaces and things like that.

    But those are MY preferences, and like me, everyone else is entitled to have THEIR preferences, even if they differ from mine.

    If you don't want to hate this job, just accept that when you work in a team, you just have to accept the team's style and try to be consistent with it.
  • 7
    BTW, I find it most frustrating that your period key is apparently broken.
  • 2
    Teach him to ctrl-alt-L, problem fixed -.-'
  • 0
    @halfflat Well, it makes it simpler to just add the next line to quickly check something if you have your braces ready, that's what I thought when they made me do that :v
  • 2
    We follow the PSR rules which recommend certain code styles

    Ofcourse we have our githooks and IDE's to do the dirty work :)
  • 0
    @halfflat imagine:
    some intern gets the code, wants to print a message before returning, goes behind your if()
    presses enter, adds a print line.

    and suddenly you have a

    if(thing)
    print();
    return;

    and suddenly you have a program that aborts in every case, without anyone noticing immediately.
  • 1
    Who cares
  • 2
    Setup ktlint (https://ktlint.github.io/) on CI and have a laugh at your colleague.

    The most important reason for proper and consistent formatting is that it helps reading the code. It's only humans who read code. The compiler just parses and interprets it and doesn't care about formatting. Humans care, because humans at some point will have to read the code to extend it or fix bugs in it.
  • 3
    This is tabs vs spaces but, like, next level pettiness
  • 0
    Still better than tabbing and aligning all the braces to the right of the screen.. o.O
  • 1
    Seems petty
Add Comment