31

I write blocks of code like this:
If(condition){
code
}

I'm trying to fix a bug and the previous dev is doing it like this:
If(condition)
{
code
}

Does anyone know any good nerve calming pill ? 😜

Comments
  • 1
    @h3ll you just opened a world for me didn't know such thing existed thanks 😊
  • 6
    There should be a code convention if multiple devs are working on the same code. If you've inherited code from another guy, you can just set the code style like you want it and format all the code at once.
  • 2
    In visual studio you can just press ctrl + k ctrl + d to automatically format the current document...i believe it formats according to what you have set in the settings.
  • 2
    Rather than formatting everything you should learn to accept that :/ else, the next dev will reformat, then the next, then the next... That's how you have inconsistent coding style, which is far worse than a consistent coding style that you don't like!
  • 1
    @willol That's why any dev team larger than 1 should probably have a coding standard. Doesn't matter what it is, but it'll certainly make everyone's life easier.
  • 0
    @T-Hammer What? I can't think of any language that a line break would make runtime slower.
  • 1
    @catchiecop, there is an option for code formatting in every IDE I know. Usually in a big project the lead or the whole team decide on a set of rules and then add to version control the code style preferences file, so everyone just uses the same.
  • 1
    Stab him
  • 1
    Different coding styles makes it easier to recognize who wrote a certain function, thus whom to blame ;)
  • 3
    @gurumeditation No. You track that in version control.
  • 1
    @ItsMrSammeh If you're doing the whole file you don't have to Ctrl+A first
  • 1
    @T-Hammer That's parsing. Most languages do that up front, so at runtime you don't need to. That said I would recommend writing it so a human can actually read it and then let a minifier or something similar loose on it before pushing it to production.
  • 0
    It would be so annoying, and funny, if your IDE was configured to use the same company convention as your colleague. ,😅😆😆😅😅😆😆😅😅
  • 0
    / \n{\n / {\n /
    Regex.
  • 2
    My computer science teacher forces us to write code the latter way and I want to kill him
  • 0
    @mell0 teachers can be a real pain in the ass sometimes
  • 1
    @mell0 Any well run software project is going to have style guidelines. Sometimes they're going to be in the C style, and sometimes in the Java. Doesn't matter which you prefer, you're going to have to follow the project's rules.
  • 1
    @psudo
    I suppose I'll never be part of a successful project then.
    I really can't stand working with other people.
  • 0
    @mell0 that is something that you'll have to learn
Add Comment