Click here to Skip to main content
15,919,121 members

Survey Results

How important is formatted code?

Survey period: 3 Jan 2022 to 10 Jan 2022

How and when should code be formatted? Brackets or Begin statements always on a new line? Always spaces after comment markers? A different style for different languages? Or whatever came out of the keyboard?
OptionVotes% 
All source code should be formatted according to a generally accepted style for that language36951.83
All code in my org must be formatted to our org's style guide19026.69
All code within a single project should be consistently formatted31444.10
All code, everywhere, should be formatted to a single style, as much as a given language allows679.41
Code should be neat and readable. That's good enough.21029.49
Format your code however you want, I'll format my code how I want567.87
I really don't care how code is formatted.162.25
Respondents were allowed to choose more than one answer; totals may not add up to 100%



 
GeneralRe: Why formatting matters... Pin
honey the codewitch4-Jan-22 5:14
mvahoney the codewitch4-Jan-22 5:14 
GeneralOrg style overrides language style. Pin
OriginalGriff2-Jan-22 22:35
mveOriginalGriff2-Jan-22 22:35 
GeneralRe: Org style overrides language style. Pin
Chris Maunder3-Jan-22 1:44
cofounderChris Maunder3-Jan-22 1:44 
GeneralRe: Org style overrides language style. Pin
OriginalGriff3-Jan-22 2:14
mveOriginalGriff3-Jan-22 2:14 
GeneralRe: Org style overrides language style. Pin
Dan Neely5-Jan-22 7:25
Dan Neely5-Jan-22 7:25 
GeneralRe: Org style overrides language style. Pin
Nemanja Trifunovic3-Jan-22 2:20
Nemanja Trifunovic3-Jan-22 2:20 
GeneralRe: Org style overrides language style. Pin
OriginalGriff3-Jan-22 2:35
mveOriginalGriff3-Jan-22 2:35 
GeneralRe: Org style overrides language style. Pin
Member 123124664-Jan-22 9:14
professionalMember 123124664-Jan-22 9:14 
Your "better" reflects my view of how things should be formatted. I really dislike both the other alternatives you show.

Although I prefer languages that use words BEGIN and END (I first used Algol nearly 50 years ago) rather than { and } (which are less easy to see - although a modern IDE will highlight and should match them) they should be indented at the same level as the content of the bracketing. After all the block with the brackets is syntactically equivalent to a single line statement which would be indented.
GeneralRe: Org style overrides language style. Pin
OriginalGriff4-Jan-22 9:20
mveOriginalGriff4-Jan-22 9:20 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.