• (cs) in reply to Anonymous

    Anonymous:
    Having curly braces on a seperate line allows you to easily scan to verify bracers match correctly.  Yes, that's trivial, but so is your argument.

    <FONT face="Courier New" size=2>guys, i have no idea what this style possibly looks like.  are you talking about the difference in:</FONT>

    <FONT face="Courier New" size=2>while (fear && loathing) {</FONT>

    <FONT face="Courier New" size=2> - versus -</FONT>

    <FONT face="Courier New" size=2>while (feat && loathing)
    {</FONT>

    [:#]

  • (cs) in reply to emptyset

    <FONT face="Courier New" size=2>fuck you, forum!</FONT>

    <FONT face="Courier New" size=2>s/feat/fear</FONT>

  • (cs) in reply to emptyset

    Jed is only (1) character short of Jedi!

  • (cs)

    This makes me cry. 

    Take some perfectly good error messages and remove them, and hope we can debug why the customer is having problems.

    I have never had a problem with customers calling tech support about a specific error they don't understand.  We can collect statistics about which error they don't understand and focus resources on either preventing that specific error, or giving a better message.   This is an easy management decisions about what errors are worth that effort.

    I have many problems because customers call "It doesn't work", perhaps with a very generic error.   I have spent weeks on these before discovering a real bug.    In fact I'm working on such a bug right now, and I have no clue why it is failing, and I still have not found any useful place to add log messages.  (Though if I add the messages everywhere the bug never shows up, so it is a timing thing)

    Yes it costs money to have users call tech support.  However it costs even more money when tech support has to run the user through a long sequence of questions before they find out which argument is bad - and the program even knows in this case.

  • (cs) in reply to RevMike
    RevMike:

    To this end I also use the ternary operator for certain simple operations.  For instance, I write a lot of code against an API that takes an array of objects.  I'll use this idiom quite a bit...

    I don't believe that the ternary operator here degrades readability, especially since it is an idiom that a reuse frequently.


    Huge fan of the ternary and think it's not used nearly enough by other developers.  It only degrades readability if the reader don't use it or understand it and, unless someone can provide a good reason as to why one shouldn't use it, it's the readers' problem. 

    I use K&R almost exclusively, for a very simple reason.  If I'm looking for a method I look for the access specifier, which comes first in a Java method declaration.  If I'm looking for a loop, I look for it's respective keywords, and presume the curly brace at the same level of indentation is the close of it.  I don't look for a curly brace which, by comparison to a keyword, is far less intuitive.  In fact, I worked for only one company that had BSD as a standard and it was eventually changed to K&R.  Generally, I find less vertical real estate more readable than having an extra line with only a scope specifier.

    Sincerely,

    Mung Kee
    (Pizza icon dysfunction sufferer)
  • Tom Legrady (unregistered)

    Another example of the Peter Princple at work

     

    No, the Peter Principle has nothing to do with Viagara spam ....See http://www.envisionsoftware.com/articles/Peter_Principle.html for an explanation.

  • suidae (unregistered) in reply to rogthefrog
    rogthefrog:

    Maurits:
    rogthefrog:

    The third style is deserving of torture and public ridicule.


    Absolutely.

    Now - no torture is strong ENOUGH punishment for that horrid brace style. It's so bad I wrote a script to reformat a coworker's code I had to maintain so I could spend my time reading the code instead of hunting for that FRICKIN' opening brace.



    I use a style similar to the third, but in pascal:

    procedure Proc1;
    begin
       if condition then begin
          somecode;
       end;

       if SomeOtherCondition then begin
          somecode;
       end else begin
          somecode
       end;
    end;

    This is usually referred to as 'hanging begin'.

    Whe I write C code I do the same thing with the curly braces, mostly out of habit.  Why do you find this style so henious?  I find that it is not necessary to look for the opening block indicator (begin or { ) in most circumstances, the indention (unless incorrect) clearly indicates where a new block begins, and the end block indicator 'out-dented' on a new line clearly ends the block.


  • (cs) in reply to hank miller

    hank miller:
    (Though if I add the messages everywhere the bug never shows up, so it is a timing thing)

    <FONT face="Courier New" size=2>not at all knowing your specific problem, but this reminds me of a bug i had once while learning c (java?  can't recall).  adding the error messages added things in memory that prevented a buffer overrun somewhere.  :)  it was probably c.  she is a harsh mistress.</FONT>

  • Anonymous (unregistered) in reply to emptyset

    WTF is "Windows-world"?

  • (cs) in reply to Anonymous

    You should probably use whichever style is accepted by the community you're working with, so that people from that community can read your code.

    For example, I use C# at the moment, so:

    function { if (test) { } }

    Though if I went to work with a company that did Java, they'd probably want me to do something like this:

    function{ if (test){ } }

    It's evil and horrible and shouldn't exist, but hey, if that's what I'm paid to do... However, I think the first of these is the ideal solution.

    As for braces vs words for begin/end delimiters, I prefer braces because they are (IMHO) less intrusive, less clunky to work with, a little quicker to type, and more visible when the function is already full of words. The downside is that you have to do your indentation properly, because if it gets messed up, you're in serious trouble. Luckily, VS.NET (and probably a lot of other IDEs) sort this out for you pretty much automatically.

  • (cs) in reply to johnl

    Damn this forum software!!! This (I hope) is what it was supposed to look like:

    function {   if (test)   {   } }

    vs

    function{   if (test){   } }

  • (cs) in reply to johnl

    I give up. You get the idea

  • (cs) in reply to johnl
    johnl:
    It's evil and horrible and shouldn't exist, but hey, if that's what I'm paid to do...

    This is the same type of vitriolic sputum you see from these political pundit jerkoffs.  Your problem, like theirs, is that you refuse to accept that someone else sees things a different way, even if their way hasn't been proven wrong.  It's simply a matter of opinion.

    johnl:
    I prefer braces because they are (IMHO) less intrusive, less clunky to work with, a little quicker to type, and more visible when the function is already full of words.


    Already full of words yeah, but are they blue?!


  • (cs) in reply to johnl

    johnl:
    I give up. You get the idea

    I've had it too with this forum...

    (AAARGH, my "delete" key won't work... AGAIN [:@])

    This is it. This is my last post, until this forum is either fixed and useable or replaced by a decent other forum. This sucks big time. I say: Let's boycot this site until it's fixed!

  • (cs) in reply to Mung Kee

    By the way, I'm astounded by the number of people who more than likely regard themselves as good programmers, also rely so heavily on a curly brace to read code.  Maybe it isn't programming skills after all.  Maybe it's just reading comprehension.

  • (cs) in reply to Mung Kee

    Mung Kee:
    RevMike:

    To this end I also use the ternary operator for certain simple operations.  For instance, I write a lot of code against an API that takes an array of objects.  I'll use this idiom quite a bit...

    I don't believe that the ternary operator here degrades readability, especially since it is an idiom that a reuse frequently.


    Huge fan of the ternary and think it's not used nearly enough by other developers.  It only degrades readability if the reader don't use it or understand it and, unless someone can provide a good reason as to why one shouldn't use it, it's the readers' problem. 

    I use K&R almost exclusively, for a very simple reason.  If I'm looking for a method I look for the access specifier, which comes first in a Java method declaration.  If I'm looking for a loop, I look for it's respective keywords, and presume the curly brace at the same level of indentation is the close of it.  I don't look for a curly brace which, by comparison to a keyword, is far less intuitive.  In fact, I worked for only one company that had BSD as a standard and it was eventually changed to K&R.  Generally, I find less vertical real estate more readable than having an extra line with only a scope specifier.

    Sincerely,

    Mung Kee
    (Pizza icon dysfunction sufferer)

    I like the ternary too, but when I had to maintain code that had ternary's nested inside eachother inside an aspx page, I wanted to rewrite the C# compiler to throw an error on the cursed question mark.

    Lisa needs braces, so long dental plan, Lisa needs braces, so long dental plan, Lisa needs braces, so long dental plan. Come on, show us your braces. Aaaauuuggghhh!!! There is no God.

    Can we just mark the whole braces discussion as a giant troll?

  • (cs) in reply to OneFactor
    OneFactor:
    ...I had to maintain code that had ternary's nested inside eachother inside an aspx page


    Now there's a good idea!
  • (cs) in reply to RobIII
    RobIII:

    johnl:
    I give up. You get the idea

    I've had it too with this forum...

    (AAARGH, my "delete" key won't work... AGAIN [:@])

    This is it. This is my last post, until this forum is either fixed and useable or replaced by a decent other forum. This sucks big time. I say: Let's boycot this site until it's fixed!



    At least you can get those damn icons to work!  I hate them more than anything but strangely I'm drawn to them.
  • (cs) in reply to Mung Kee

    Ok, Mung Kee, maybe I was a little too hard on the "opening brace on the same line" thing. It's probably just that I'm used to it being on the next line, but that just seems easier to me. Either way, modern tools help loads.

    As for begin/end keywords... I think you're right - before programming skills can come into it, you have to actually parse the document, so to speak, and that's down to how it's laid out. It's the same skills working here that allow you to read a report or browse a website, or look for something in a book, none of which necessarily need programming skills. Of course, programming skills can help by telling you what to expect (though that assumes that the person wrote it in the same way you would), but at this point, if you need them, then it's poorly laid out.

    I feel that braces offer a more visible difference to the contents of the function than keywords do.

    Also, don't assume it will always be blue - suppose you're viewing it in a comparison app that doesn't do syntax highlighting for that language?

    Basically, I can work with begin/end keywords, and have done in the past, but I just prefer braces.

  • Alistair Wall (unregistered) in reply to hank miller

    (Though if I add the messages everywhere the bug never shows up, so it is a timing thing)

    We have a lot of those, and it is not timing. In Selligent/Centura script, certain commands hang if the subsequent command is not a message box.

  • Kreg (unregistered) in reply to jose cuervo

    Ambiguate is a word by the same logic that disambiguate is. It is simply not used idiomatically because it is much clearer to simply refer to one having confounded, obscured, or clouded the meaning. For that matter, I don't believe disambiguate was in any wide idiomatic use until Microsoft started using it in all it's literature and before it, Sun. But wisely, when the technical writing called for a more precise term than colloquial English provided, they adopted or modified an already existing term from another field rather than needlessly inventing a new one, which would have been an out of character excercise in ingenuity--if not down right disengenuous. This reminds me of the "Creationists" who assert that evolution is "only a theory". Yes, but in the same technical sense that gravitation, "Quantum Electro Dynamics", and "Special Relativity" are "theories". We should be happy that "disambiguate" does not have a sloppy colloquial cousin meaning something clear and precise like "to make noise".

    The argument reminds me of  a classmate in a college algorythm analysis class who complained about the author's frequent use of the term "non-negative integer", to which we all cut him a look and one of us replied "because it's better than always saying 'positive or zero' you dufus". This was the same student who, after learning about Knuths work on sort algorythm efficiency, remarked that it was too late to become a programmer, that everything had already been done!

    The emergeance into tech-speak of words like disambiguate and (God help us) "Attritted", are healthy. It is this fungeability that has made the English language so successful. This is an example of the normal healthy evolution of language and we must respond with cogence. Hah!

    At any rate, it's better than making up acronyms and emoticins. Not that there isn't a place for both (and this would be that place) but the first time I see "WTF" used in the Wallstreet Journal, that's it! I'm moving to another solar system!

  • (cs) in reply to OneFactor
    OneFactor:

    That's a WTF in of itself [H]. Now I see how WTF code makes it into production, all the developers who know better spend their day arguing with each other over curly brace styles and so the PM forbids all code reviews in order to let the janitors clean the blood off the floor quicker than it spills.

    Which is why smart people move to languages without any braces so as to avoid that kind of issues

    koedoot:
    Removing the curly brackets is really annoying.

    But giving too detailed error messages does not give your program a professional look, if i got an errormessage like this:
    ArgumentException: if expansionRate is 1, partCoefficient cannot possibly be 1
    (Ever had one like that?)
    It usually does not help the user since he/she does not know the internals of your programs.
    But it leaves the user whit a bad idea about your software, because it gives al kind of weird errormessages
    An errormessage like this:
    ArgumentException: Invalid Arguments.
    looks much better imho, and is much more userfriendly.
    For a developer using the code it is indeed not very practical.

    That just leaves a typo in the last line, which had to be something like
    if (invalidArgs > 0)

    Coders with more than half a brain will catch any leaking exception (you don't want the users to SEE your exceptions anyway, now do you?) and log them somewhere, displaying a nice&friendly error message in the process.

    The one who uses the exception is the dev, or the dev team that has to patch the bug, and a damn frigging useless exception/exception trace is... not really helpful as far as testing/finding/fixing the issue goes.

    Omnifarious:

    That isn't a style. That's something that has real-world performance implications that can be quite significant. In C++ the postfix ++ operator requires that a temporary be made, then destroyed, and the prefix one does not. So, I do strongly recommend that everybody always use prefix when it's convenient. This is even in cases where it doesn't really matter, because the habit is a good one.

    That would be an issue if compilers didn't handle that kind of simple optimization issues.

    Most of them do

    johnl:
    As for braces vs words for begin/end delimiters, I prefer braces because they are (IMHO) less intrusive, less clunky to work with, a little quicker to type, and more visible when the function is already full of words. The downside is that you have to do your indentation properly, because if it gets messed up, you're in serious trouble. Luckily, VS.NET (and probably a lot of other IDEs) sort this out for you pretty much automatically.

    Whitespace-marked blocs.

    Get rid of any typing and any useless information, double win

  • (cs) in reply to Anonymous

    Anonymous wrote:

    WTF is "Windows-world"?

    It's much like "Waterworld". Expensive, and crap.

    But without Kevin Costner, which is about the only thing I can come up with in its favour.

    Oh, and K&R style, 2 space indentation and no fscking tabs, but that's latter part's just for me. I have no fear of reformatting indentation as a half-way-decent change management tool will only show non-whitespace differences. diff -bBe would work, for example.

    Simon

  • (cs) in reply to johnl
    johnl:
    Also, don't assume it will always be blue - suppose you're viewing it in a comparison app that doesn't do syntax highlighting for that language?


    On very rare occassion do I browse anything without syntax highlighting.  Really the only time I do is when I'm deploying to a server via NetMeeting or VNC which doesn't have an IDE.  If it becomes all that common a problem, I would tend to put SOME SORT of IDE on the machine, but have no problem reading non-highlighted code.  I can't imagine many people are hopping around to new servers, which don't have any environment set up.  Sure, on rare occassion you need to browse files in production.  Now, if we're talking about reading poorly indented code, I would get pretty angry trying to read through that mess.
  • Anonymous (unregistered) in reply to Djinn
    Djinn:
    Anonymous:
    Omnifarious:

    While I will forcefully edit code that assumes that everybody has changed their tab stop settings from the default of 8 to 4 then used tabs to indent all their code, I won't change code that has the obnoxious 'curly brace on a line by itself' style. But it is obnoxious.

    It's justified when the code inside the () for the while or if or whatever spans multiple lines. because otherwise the code for what's inside can scan and get mixed together with the code outside. But otherwise, it just introduces pointless whitespace.

    There is pointful whitespace that helps separate different functional groupings of code. And there's pointless whitespace which does nothing more than add a useless line that keeps me from seeing as much as i want to in my editor window. I can see no good reason to separate the code for an if, while, or for block from everything else when you have many other useful visual cues like whitespace. The code inside is obviously very related to the conditionals outside since its execution depends on their value.



    Having curly braces on a seperate line allows you to easily scan to verify bracers match correctly.  Yes, that's trivial, but so is your argument.

    That said, it's a design style.  It's like arguing about whether to use pre- or post- unary operators.  Stick with whatever your companies coventions are.


    Careful with that axe, Eugene.

    int a = 0;

    a = a++ + 1;
    System.out.println(a);

    a = ++a + 1;

    System.out.println(a);

    Run that in Java. Now, switch to C/C++ (changing variable printing accordingly), and run it against many different compilers/platforms.



    I knew I should have been more specific...

    Obviously, that performs differently.  Personally, I think that is some WTF code on it's own if used in anything real.  It's a silly example from a CS 101 book about how the operators are different.  In real code, that syntax isn't good for readability.

    I meant arguing curly brace style is the same as arguing about:

    for( int i = 0; i< 10; ++i )
    {
        ...
    }

    vs

    for( int i = 0; i< 10; i++ )

    {

        ...

    }

  • (cs) in reply to johnl
    johnl:

    I feel that braces offer a more visible difference to the contents of the function than keywords do.



    I switch between C and Pascal, with the the vast majority of the time spent in pascal, and find it the other way around, a nice chunky 'end' makes a more recognizable and consistant visual seperator than a little skinny {.  But then I like the way an 'end' or 'begin' keyword matches up with the look of the text of the body of a routine.  C code always looks anemic.

    Besides all that, I prefer typing several letters to stretching both pinkies to hit a curly brace :p  If the were somewhere else on the keyboard I might like the better.

  • ColdPie (unregistered) in reply to Anonymous

    Take a look at this... (I removed comments and such)

    How is that difficult to read? It seems incredibly obvious to me where each block starts. Simply look up until you find the first indented line at that indentation level, as the blue lines illustrate in the picture. So long as you're not dealing with poor indentation, I don't think it gets much more clear than that.

    Let's try using this software with HTML...

  • (cs) in reply to ColdPie
    Anonymous:

    Take a look at this... (I removed comments and such)

    How is that difficult to read? It seems incredibly obvious to me where each block starts. Simply look up until you find the first indented line at that indentation level, as the blue lines illustrate in the picture. So long as you're not dealing with poor indentation, I don't think it gets much more clear than that.

    Let's try using this software with HTML...

    8 spaces is quite close to "poor indentation" in my book.

  • (cs) in reply to ColdPie

    Since everyone else is doing it, I'll post my bracing style as well. It's rather complex:

    class SomeClass
    {
    public:

    void someFunction()
    {
    if(condition) {
    // code
    }
    while(very long condition &&
    that takes more than one line)
    {
    // code
    }
    switch(variable)
    {
    case BECAUSE:
    break;
    }
    // ... I'm weird.
    }
    };

    So there you have it. Classes and functions have their opening brace on a line of their own, as do switch statements and all other statements where the condition is too long for one line.

  • (cs) in reply to masklinn
    masklinn:
    Anonymous:

    Take a look at this... (I removed comments and such)

    How is that difficult to read? It seems incredibly obvious to me where each block starts. Simply look up until you find the first indented line at that indentation level, as the blue lines illustrate in the picture. So long as you're not dealing with poor indentation, I don't think it gets much more clear than that.

    Let's try using this software with HTML...

    8 spaces is quite close to "poor indentation" in my book.



    Amen.  4!  No more, no less.
  • (cs) in reply to RevMike
    RevMike:
    Noisy Crow:

    And I must say, that *is* one way VB and TSQL beats out C-style languages - the block markers are big enough that they don't vanish when you squint!


    Well, you knew it was coming.  Single char block grouping delimiters are far better than blocks marked with words.

    Allow me to demonstrate...

    Open up a C style language source file in vi.  Put the cursor over any opening delimiter, be it '(', '{', or '['.  Then press the % key.  Viola!  The editor has immediately found the match.  Press % again and go back to the starting delimiter.  Is the indent level wrong?  Press >, then % and move the entire block in one level.  Need to delete the entire block?  Press d then %.  Need to copy the entire block to a cut and paste buffer?  Press y then %.

    It is much more difficult to do these kinds of operations in word delimited languages.  Now I'm sure that there are some good editors out there that can do these kinds of things for one language on one platform.  Of course when I change languages or platforms I'd need to learn an all new commands.  I'd much rather use the same editor everywhere.  And with vi/vim (www.vim.org) I can do so freely and easily.



    I couldn't agree more!!!!
    Stop this begin/end nonsense right away please, WTF!!!

    For the java-eclipse fans, it's CTRL-P you're looking for to match delimiters.

    Matt

  • (cs) in reply to Mung Kee
    Mung Kee:
    masklinn:
    Anonymous:

    Take a look at this... (I removed comments and such)

    How is that difficult to read? It seems incredibly obvious to me where each block starts. Simply look up until you find the first indented line at that indentation level, as the blue lines illustrate in the picture. So long as you're not dealing with poor indentation, I don't think it gets much more clear than that.

    Let's try using this software with HTML...

    8 spaces is quite close to "poor indentation" in my book.



    Amen.  4!  No more, no less.


    To add to this, easily read code is much more about proper indentation than it is curly braces and keywords.
  • (cs) in reply to Matt Casters
    Matt Casters:


    For the java-eclipse fans, it's CTRL-P you're looking for to match delimiters.



    Sorry about that typo, it's CTRL-SHIFT-P ofcourse.
  • (cs) in reply to Matt Casters
    Matt Casters:
    RevMike:
    Noisy Crow:

    And I must say, that *is* one way VB and TSQL beats out C-style languages - the block markers are big enough that they don't vanish when you squint!


    Well, you knew it was coming.  Single char block grouping delimiters are far better than blocks marked with words.

    Allow me to demonstrate...

    Open up a C style language source file in vi.  Put the cursor over any opening delimiter, be it '(', '{', or '['.  Then press the % key.  Viola!  The editor has immediately found the match.  Press % again and go back to the starting delimiter.  Is the indent level wrong?  Press >, then % and move the entire block in one level.  Need to delete the entire block?  Press d then %.  Need to copy the entire block to a cut and paste buffer?  Press y then %.

    It is much more difficult to do these kinds of operations in word delimited languages.  Now I'm sure that there are some good editors out there that can do these kinds of things for one language on one platform.  Of course when I change languages or platforms I'd need to learn an all new commands.  I'd much rather use the same editor everywhere.  And with vi/vim (www.vim.org) I can do so freely and easily.



    I couldn't agree more!!!!
    Stop this begin/end nonsense right away please, WTF!!!

    For the java-eclipse fans, it's CTRL-P you're looking for to match delimiters.

    Matt



    CTRL-P?  You sure you want to go with that?
  • (cs) in reply to Mung Kee

    Mung Kee:
    Amen.  4!  No more, no less.

    I agree.  Although, if I had to choose between more or less, I would definitely pick more.  I used to work with a guy that used 2-space tabs and his code was completely  unreadable.

    [image]

  • (cs) in reply to Ytram
    Ytram:

    Mung Kee:
    Amen.  4!  No more, no less.

    I agree.  Although, if I had to choose between more or less, I would definitely pick more.  I used to work with a guy that used 2-space tabs and his code was completely  unreadable.

    [image]



    He must have had very poor peripheral vision.
  • (cs) in reply to Mung Kee
    Mung Kee:
    Ytram:

    Mung Kee:
    Amen.  4!  No more, no less.

    I agree.  Although, if I had to choose between more or less, I would definitely pick more.  I used to work with a guy that used 2-space tabs and his code was completely  unreadable.

    [image]



    He must have had very poor peripheral vision.


    I find it hilarious that folks who advocate putting the opening brace on the same line because it saves vertical space almost always use 4-space or 8-space tabs, thereby wasting horizontal space. They also tend to put braces around single-statement blocks, like so

    if (wtf) {
      ++lol;
    }

    instead of

    if (wtf)
      ++lol;

    The vertical space argument is bunk. Assuming you display about 30 lines on the average screen, are there really enough blocks that an extra line for an opening brace in each block really hampers your productivity and the amount of code you can read on one screen? Give me a break.

    I use 2-space indentation and opening braces get their own line. Single-statement blocks don't get braces. I have never had a bug where I added a statement to an if- or while-scoped block that only had one statement before and forgot to add braces around it, so the argument "yeah well you should always enclose blocks in braces cuz it makes it easier to add additional statements later" is crap as well - how much goddamn work is it to add a pair of braces?

    Repeat after me: 2-space indents and braces on their own lines is the way of the lord.
  • (cs) in reply to Mung Kee

    [image]  Use the source Mung Kee.  You will find the secret of the pie.[image]

  • (cs) in reply to Alex Papadimoulis

    Brillant is too!

  • (cs) in reply to emptyset

    [pi]

    [image]

  • (cs) in reply to rogthefrog
    rogthefrog:

    I find it hilarious that folks who advocate putting the opening brace on the same line because it saves vertical space almost always use 4-space or 8-space tabs, thereby wasting horizontal space. They also tend to put braces around single-statement blocks, like so

    if (wtf) {
      ++lol;
    }

    instead of

    if (wtf)
      ++lol;

    The vertical space argument is bunk. Assuming you display about 30 lines on the average screen, are there really enough blocks that an extra line for an opening brace in each block really hampers your productivity and the amount of code you can read on one screen? Give me a break.

    I use 2-space indentation and opening braces get their own line. Single-statement blocks don't get braces. I have never had a bug where I added a statement to an if- or while-scoped block that only had one statement before and forgot to add braces around it, so the argument "yeah well you should always enclose blocks in braces cuz it makes it easier to add additional statements later" is crap as well - how much goddamn work is it to add a pair of braces?

    Repeat after me: 2-space indents and braces on their own lines is the way of the lord.


    Nowhere did you make an argument for why braces should be placed on separate lines. So, even if I accept your arguments, there's no reason I should buy into your final statement because you've proven nothing.

    Sincerely,

    Richard Nixon

  • (cs) in reply to OneFactor

    Hear, hear!  WTF, Indeed.

  • (cs) in reply to Richard Nixon

    [image]


    Sincerely,

    Richard Nixon

  • (cs) in reply to rogthefrog
    rogthefrog:

    The vertical space argument is bunk. Assuming you display about 30 lines on the average screen, are there really enough blocks that an extra line for an opening brace in each block really hampers your productivity and the amount of code you can read on one screen? Give me a break.

    So what's your argument FOR using a separate line for starting curly braces?  It's either lack of code comprehension or reading comprehension.  That lonely curly brace is a crutch for the feeble minded engineer.

    rogthefrog:

    I use 2-space indentation and opening braces get their own line. Single-statement blocks don't get braces. I have never had a bug where I added a statement to an if- or while-scoped block that only had one statement before and forgot to add braces around it, so the argument "yeah well you should always enclose blocks in braces cuz it makes it easier to add additional statements later" is crap as well - how much goddamn work is it to add a pair of braces?

    I like how you don't provide a case for your style but still expect someone to adopt it.  I would love to see a good sized method with 2 space indentation.  Why don't you post it and I'll go get the Advil?

    rogthefrog:

    Repeat after me: 2-space indents and braces on their own lines is the way of the lord.

    Great, another f-in preacher.  Your 'lord' must be the Engineering equivalant of L Ron Hubbard (or Tom Cruise, I can't decide which).
  • (cs) in reply to Richard Nixon
    Richard Nixon:

    Nowhere did you make an argument for why braces should be placed on separate lines. So, even if I accept your arguments, there's no reason I should buy into your final statement because you've proven nothing.

    Sincerely,

    Richard Nixon



    I made an argument that is usually accepted without question in about 20 states in the US: "for it is the way of the lord".

    My real argument is that, in order to find the opening brace, I only need to scan up from the closing brace, or two spaces left and one line up from the first statement. Indentation is a visual means of showing that the statements all belong together inside a block; by the same token, the delimiters for said block belong together on the same vertical line.

    By putting the opening brace on its own line, it's ALWAYS IN THE SAME HORIZONTAL LOCATION given an identation level. That's a Good Thing in terms of usability - like the Mac system bar being at the top of the screen, or the Start button in the bottom left-hand corner: you can't miss it. If the opening brace is at the end of the line, it's never in the same horizontal position, because lines have variable lengths. It's like installing a light switch at a variable height on the wall depending on how long the room is. It's bad behavior and should be punished by death.
  • (cs) in reply to Mung Kee
    Mung Kee:

    I like how you don't provide a case for your style but still expect someone to adopt it.  I would love to see a good sized method with 2 space indentation.  Why don't you post it and I'll go get the Advil?


    And you're the one criticizing my lack of reading comprehension, when you can't handle a smaller indentation step?

    "Those 2 or 6 extra indentation spaces are a crutch for the feeble minded engineer."

    Sheesh. I know monkeys with better reasoning power than you.
  • (cs) in reply to rogthefrog

    Another thing about the "saving space" argument for putting the brace at the end of the line: if that's the case, then, why not put every fricking statement on one line? You could have a giant 100kb one-liner. There'd be no wasted space whatsoever.

    If you accept the argument that indentation helps readability, then you should also accept that having the brace on its own line performs the same function, at least for some people.

  • (cs) in reply to rogthefrog
    rogthefrog:
    I made an argument that is usually accepted without question in about 20 states in the US: "for it is the way of the lord".

    Beastiality technically isn't illegal in every state either, but that doesn't make right. 

    rogthefrog:

    My real argument is that, in order to find the opening brace, I only need to scan up from the closing brace, or two spaces left and one line up from the first statement. Indentation is a visual means of showing that the statements all belong together inside a block; by the same token, the delimiters for said block belong together on the same vertical line.

    My argument is that all I have to do is find the character that's in the same vertical line.  Your brain doesn't even have to process what character that is.  If the indentation is consistent, I don't care if it's curly brace or a letter.

    rogthefrog:

    By putting the opening brace on its own line, it's ALWAYS IN THE SAME HORIZONTAL LOCATION given an identation level. That's a Good Thing in terms of usability - like the Mac system bar being at the top of the screen, or the Start button in the bottom left-hand corner: you can't miss it. If the opening brace is at the end of the line, it's never in the same horizontal position, because lines have variable lengths. It's like installing a light switch at a variable height on the wall depending on how long the room is. It's bad behavior and should be punished by death.

    And knowing that it's definitely a curly brace in that column while scanning up saves how much time for the scan?  I submit 0ms.

    Your light switch analogy is irrelevant and pointless too.
  • ColdPie (unregistered) in reply to Mung Kee
    Mung Kee:
    masklinn:

    8 spaces is quite close to "poor indentation" in my book.



    Amen.  4!  No more, no less.


    I agree with you both. I use MSVC++, which defaults to four-space tabs, but chose to open that file in Notepad (defaults to eight-space tabs) because it doesn't have syntax highlighting (which would have detracted from my point).  Don't worry, Notepad is no longer my "IDE" ;)

    Why does the CAPTCHA always fail on the first try?
  • (cs) in reply to rogthefrog
    rogthefrog:
    Mung Kee:

    I like how you don't provide a case for your style but still expect someone to adopt it.  I would love to see a good sized method with 2 space indentation.  Why don't you post it and I'll go get the Advil?


    And you're the one criticizing my lack of reading comprehension, when you can't handle a smaller indentation step?

    "Those 2 or 6 extra indentation spaces are a crutch for the feeble minded engineer."

    Sheesh. I know monkeys with better reasoning power than you.


    My point, as you'll see in a previous post, is that readability is more about indentation than vertical spacing or curly braces.  That's the way I read code anyway.

    BTW, nice play on my nickname.  I never would have thought of that.  To paraphrase, "Hey, 'Mung Kee' sounds just like 'monkey'!"

Leave a comment on “Argument About Argument Validation”

Log In or post as a guest

Replying to comment #:

« Return to Article