
- Post History
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
on 07-24-2022 06:31 PM
This is not going to be a lengthy article, but since I do not have access to create blog entries, this is as good a place as any.
Is there anyone in business today who has not heard the "I don't know, I guess it's just because that's how it's always been done" excuse? I know I have, plenty of times. I have also read or heard numerous discussions about rejecting the excuse without even a discussion of why that was the case. Sometimes there is a good reason for the way things have always been done, and other times, a new approach is worth considering.
I would like to bring up an opposing case, one in which the way it's always been done is so ingrained that many will find excuses to avoid trying something new or discussing alternatives. I am sure that I will receive plenty of push-back about what I am expressing, but I'm curious how hard-lined people are to the old standards. I'm referring to code spacing. No, not the preceding spacing for indentation. There will always be plenty of arguments for 2-spaces vs 4-spaces vs tabs and I'm not going to stir that pot... today. I'm talking about the spacing around keywords, parameters, and other entities that are adjacent to or inside of various grouping characters like (), {}, [], etc.
Most of the code I see will have keywords and code block braces separated from their adjacent parentheses like
if (some_value==some_other_value) {
It's like you don't know the "if" is a keyword or that the code block is about to begin. Most developers know what "if" is and most editors will even color-code it so it stands out. Your brain has already been trained and does not need to have it called out this way. Then you get the parentheses with the conditional expression crammed together like it's unimportant. When I'm troubleshooting or modifying existing code, the conditional expression is the part that my brain needs to focus on, the part I need to make sure I can understand. I much prefer spacing out the parts that I need to be able to quickly recognize:
if( some_value == some_other_value ){
When a team works together, I do believe that having a consistent standard for the whole team is valuable, but when I have the choice, I much prefer a more readable layout. What are your thoughts?
- 322 Views
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
I do all my coding in vscode (via SNUtils sn-scriptsync) and use the Prettier - Code formatter extension. Lots of control and I love the default options.