Indenting and brace styles

(Calvin Krusen) #1

From the list below, what’s your preferred style?

I originally started with #4, but now prefer #7

I like the braces to line up with the statements. It helps identify the end of a group. And yes I know that all modern editors will do brace matching and what not.

(Aaron Willett) #2

I’m a #2.
It’s what I was taught in college and it stuck with me.

(Pierre Hogue) #3

as well for readability and long time use.
edit: and probalby due to Pascal… :wink: my first taught language…!

(Calvin Krusen) #4

2 would be the Allman style

All the styles above are from the above wikipedia page

(Aaron Willett) #5

I remember having exercises where we were limited to the number of lines of code we could write… curly braces were included in the line count and they forced us to use that style. Made for some interesting solutions.

(Jason Stephens) #6

#2 - I like the block structure it provides.

Interesting posts today @ckrusen. Thanks for sharing. I had no idea that this level of style documentation was even out there.

(Randy Stulce) #7

SHIVERS How dare you use such language here! :wink: :crazy_face:

I’m also with using #2

(Calvin Krusen) #8

BTW - I never liked that the closing brace of a C switch() statement didn’t line up …

	case 1:
		// do this
		// do that
	case 2:
		// do this for 2
		// do that for 2
		// do alternate

When using style 7, the closing brace should be at the same indent of the line above it. And I was not going to start addinging braces to the case blocks like

		// do alternate

(Chris Conn) #9

#2 definitely for me.

May all javascript programmers who use brackets on the same line as code be strung up by their toenails :stuck_out_tongue:

I agree Calvin, lining up braces is essential for easily being able to eyeball complex nested statements (although newer IDE’s handle this for you - Epicor not so much)

@Hogardy While i started toying with Basic, Pascal was my first real language as well. Borland Delphi

(Mark Wonsil) #10
   /* Same Here */

(Pierre Hogue) #11

Did not have a choice at that time… hey it was the 80’s ! c language was not yet isotified !

Mind you I never used Pascal during my work. I was using machine language :tired_face: and C…:slightly_smiling_face: . when I started the working world…


(Calvin Krusen) #12

Pascal was the Comp-Sci 101 requirement for engineers at my college. :frowning:
And that was on the original Macintosh computer.

(Steven Jones) #13

Python FTW? Where indenting dictates the structure.

- Steve

(Jason Stephens) #14

Fixed it for ya :wink:

(Aaron Willett) #15

I quite like Python. It’s fun!

(Randy Stulce) #16

Same here, I was in the first year of High School programming class and it was Pascal, lead by some cantankerous teacher that didn’t really help us learn.

(Bart Elia) #17

I am a fan of option 2 but wanted to note one option you did not include which I ban:


with or without spaces in front of the DoSomething I don’t care but it is too darned easy to try and add or remove logic around this and get some interesting bugs:


If you were clear in the initial use, you will please your future self or the axe murderer who knows your address and takes over your code in the future


(Jose C Gomez) #18

That was a big bug a few years ago Apple Bug

(Calvin Krusen) #19

is really


(Calvin Krusen) #20

GOTO in a C program?

Part of the standard or not, that’s heresy!