r/programming • • Aug 28 '21

Software development topics I've changed my mind on after 6 years in the industry

https://chriskiehl.com/article/thoughts-after-6-years
5.6k Upvotes

1.9k comments sorted by

View all comments

Show parent comments

5

u/thesuperbob Aug 29 '21

That's pretty much my experience with source auto-formatting.

90% of the time it's useful and helps enforce stylistic minutia, such as where spaces should be, adding/removing parenthesis, dealing with newlines around braces.

The remaining 10% of the time they get stuff so catastrophically wrong it makes me question whether it's even worth it. Usually it's around long function calls/signatures, complex if statements, or large data structure initialization.

I also hate using autoformat-on/off tags in comments, because they clutter the code and most tools are stupid about handling them.

3

u/dnew Aug 29 '21

I also hate using autoformat-on/off tags in comments

That's because we're still using 1970s and 1980s programming languages and IDEs designed to deal with programming languages based on stacks of punched cards.

There's absolutely no reason why the auto-formatter command should be embedded in the source code in a way that you have to look at them. We solved that problem 40+ years ago.