6 ms·
Well, you know, it sounds kind of nice to have your codebase auto-formatted so it looks nice without the programmer having to do this by hand. Problem is, curre
by cjfd 5y ago
Well, you know, it sounds kind of nice to have your codebase auto-formatted so it looks nice without the programmer having to do this by hand. Problem is, current formatters never seem to exceed the borderline-passable level of formatting and I actually really like nicely formatted code. E.g., when the parameter list of a function no longer fits on the same line as the function name one can either split it over two lines or give every parameter a line by itself. I tend to make this depend on how complex the parameters are. If they are very simple, like just a short variable name I put them on one line and if they are some complicated expression I will put each of these expressions on a line by themselves. I think this really makes a difference in readability. Auto formatters generally have some fixed one-size-fits-all policy for this. And this is just one example. There are many more cases where a tasteful approach yields more readable code than a very uniform approach.
Besides this, I have also seen situation where the formatting guide lines become a way for one developer to force his preferences on another developer. This is really not nice. I have been in a situation where I really had difficulty reading the code just because it was formatted in a strange way. 'We just have to pick something and picked this'. 'No we cannot have exceptions because we don't want to waste time on discussing trivial matters like code formatting'. 'Yes, my personal exceptions to the standard that we use were applied but yours cannot'.