Coding Style - White space
- jordansparks
- Site Admin
- Posts: 5746
- Joined: Sun Jun 17, 2007 3:59 pm
- Location: Salem, Oregon
- Contact:
Coding Style - White space
In r430, fcarlier comments, "Ran CTRL+K,CTRL+D on this document. This auto-updates the lay-out." The result seems to be an increase in white space. I'm OK with this. (of course, I don't think it's his intention to apply such a sweeping change to our trunk). I'll be rewriting the Coding Style page to conform more to industry standards. However, I would strongly prefer to keep the restriction in place to not allow extra blank lines within methods. It's a totally inefficient waste of space. And, of course, leading tabs instead of spaces will continue to be important.
Jordan Sparks, DMD
http://www.opendental.com
http://www.opendental.com
Yes, of course this is on my branch and not the trunk.
About blank lines in methods, I usually prefer them because that way, your code gets structured into smaller blocks -- just like you structure text into paragraphs. Of course, when moving my changes into the trunk, I can always remove it.
What CTRL K, CTRL D does, is re-formatting the code you have to the style you defined in the Visual Studio options. For example, it will automatically update bracing style, indentation (replace spaces by tabs and vice versa) and so on.
It also adds whitespace between operators and so on (something Open Dental currently doesn't have).
I did this because the indentation on some methods in ContrDocs was off. This fixed that (but in a rather intrusive way).
About blank lines in methods, I usually prefer them because that way, your code gets structured into smaller blocks -- just like you structure text into paragraphs. Of course, when moving my changes into the trunk, I can always remove it.
What CTRL K, CTRL D does, is re-formatting the code you have to the style you defined in the Visual Studio options. For example, it will automatically update bracing style, indentation (replace spaces by tabs and vice versa) and so on.
It also adds whitespace between operators and so on (something Open Dental currently doesn't have).
I did this because the indentation on some methods in ContrDocs was off. This fixed that (but in a rather intrusive way).
- jordansparks
- Site Admin
- Posts: 5746
- Joined: Sun Jun 17, 2007 3:59 pm
- Location: Salem, Oregon
- Contact:
I'm a bit fanatical about getting the indentation correct. So if it's not right someplace, then explicitly fixing it is the thing to do. And also informing whoever got it wrong.
Jordan Sparks, DMD
http://www.opendental.com
http://www.opendental.com
- jordansparks
- Site Admin
- Posts: 5746
- Joined: Sun Jun 17, 2007 3:59 pm
- Location: Salem, Oregon
- Contact:
Reduction of white space isn't to save space in the compiled program. Instead, it serves these purposes:
1. Consistency. The more similar all the code in the program is, the more efficient it is for us.
2. Readability. If blank lines are left in methods, it makes it hard to tell where the divisions between methods are.
3. Compactness. Less scrolling. I hate to scroll.
Frederik can probably get away with non-compliant white spacing because I value the high quality of his code enough not to make a big deal about it. But if anyone else leaves blank lines, you can bet I will let them know about it. And I will admit that other variations in white space are becoming less important as we move to much larger monitors (I have a 28"). That's why most of the white space guidelines are now gone from our website and it's much more relaxed.
1. Consistency. The more similar all the code in the program is, the more efficient it is for us.
2. Readability. If blank lines are left in methods, it makes it hard to tell where the divisions between methods are.
3. Compactness. Less scrolling. I hate to scroll.
Frederik can probably get away with non-compliant white spacing because I value the high quality of his code enough not to make a big deal about it. But if anyone else leaves blank lines, you can bet I will let them know about it. And I will admit that other variations in white space are becoming less important as we move to much larger monitors (I have a 28"). That's why most of the white space guidelines are now gone from our website and it's much more relaxed.
Jordan Sparks, DMD
http://www.opendental.com
http://www.opendental.com