I just got dinked for my indent style on StackOverflow.
I wrote an answer to someone's question, even as I figured there are much better ways to handle his greater issue than store everything in text files like that.
Nearly immediately, I see this: For uncuddled elses the practice is to let the closing block brace } be vertically aligned with the following elsif.
I remember when I started coding oh so many years ago. I remember looking at GNU style and not liking it.
"You've disconnected the beginning brace from the conditional", I thought. "I can't code like that."
The other primary style people talk about is K&R.
"Better", I thought. "The beginning of the block is connected to the conditional, so that's good. But the end. The brace at the end of the block won't tell you it's connected to the block at all. Nope."
It's about the readability. The part that's in the main part of the code is the if statement. The block should be separate from the sounding code, and this style (I'm told it's Ratliff style) is what I've been using since.
My first degree was in journalism, and part of how I proved myself in my first computing jobs is making the large text blocks of the early web attractive and readable. At least, as far as early web browsers let you. And, while I am a vocal Python hater, and a hater of significant white space in programming languages in general, by-the-books Python is close to how I like to format code. (Just be sure to tell your editor that \t is the devil's work and should be shunned.)
Below is my .perltidyrc. I believe I first started using that tool soon after I read Perl Best Practices by Damian Conway. Ironically, perhaps, I moved to the long form because I found the terse form found in PBP to be unreadable and uneditable, anyway.
I wrote an answer to someone's question, even as I figured there are much better ways to handle his greater issue than store everything in text files like that.
Nearly immediately, I see this: For uncuddled elses the practice is to let the closing block brace } be vertically aligned with the following elsif.
I remember when I started coding oh so many years ago. I remember looking at GNU style and not liking it.
if ($boolean) { ... }
"You've disconnected the beginning brace from the conditional", I thought. "I can't code like that."
The other primary style people talk about is K&R.
if ($boolean) { ... }
"Better", I thought. "The beginning of the block is connected to the conditional, so that's good. But the end. The brace at the end of the block won't tell you it's connected to the block at all. Nope."
It's about the readability. The part that's in the main part of the code is the if statement. The block should be separate from the sounding code, and this style (I'm told it's Ratliff style) is what I've been using since.
if ($boolean) { ... }
My first degree was in journalism, and part of how I proved myself in my first computing jobs is making the large text blocks of the early web attractive and readable. At least, as far as early web browsers let you. And, while I am a vocal Python hater, and a hater of significant white space in programming languages in general, by-the-books Python is close to how I like to format code. (Just be sure to tell your editor that \t is the devil's work and should be shunned.)
Below is my .perltidyrc. I believe I first started using that tool soon after I read Perl Best Practices by Damian Conway. Ironically, perhaps, I moved to the long form because I found the terse form found in PBP to be unreadable and uneditable, anyway.
If you have a problem with my code alignment,
I'd rather offend you with substance than with style, anyway.
perltidy
exists. Use it. I'd rather offend you with substance than with style, anyway.