Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [platform-ui-dev] Formatting

I like formatting but I'm used to being in the minority so I gave up pushing for it long ago. But since you asked here's my 2 cents. If everybody used the same formatting rules and formatted consistently then it wouldn't be a problem. Even in small groups though, I've found it hard to get everybody to agree on the simplest trivial things like whether or not there should be a space after a cast.
 
I'm of the opinion that the format of the code is not worthy of a second thought, as long as it doesn't get in the way of readability and maintainability. I find it easier to read consistently formatted code (not just internally consistent but consistent with other projects in the same space) and it can help prevent some silly errors like if/then/else mismatches. For my own projects (that I don't have to argue with anybody about :), I find it easier to type in code without regard to format and then hit Ctrl-Shift-F to make everything line up nicely. Often I do a Ctrl-Shift-O before that and a Ctrl-Shift-S after so it's a nice "finger macro" sequence.
 
If you do decide to keep formatting, I suggest that you NOT mix format changes with any other changes. That would take care of point #3.
 
If there was one format pass (wasn't that was already done? or was that just Platform/Core?) and if everybody used the same format rules (REGARDLESS of what they are, who cares?) and if everybody ran format automatically before checking in then that would take care of the other points, at least for branches and revisions after that first format pass. That's because only lines that were changed would have any potential for moving around in the reformat. However, while formatting has some other advantages besides 'prettiness', that's a lot of if's to string together.
 
This is just me, but I find that NOT being able to do a reformat any time I feel like it feels ever so slightly oppressive and limiting, like not being able to refactor things. It's one more thing to worry about ('am I following the style of the code I'm modifying? do I have all my braces lined up for the next person?'). If the problems with unnecessary diffs could be addressed and format was transparent and automatic then the code becomes, as it should be, an _expression_ of an idea and not an idea itself.
 
See also:
 https://bugs.eclipse.org/bugs/show_bug.cgi?id=45512
 https://bugs.eclipse.org/bugs/show_bug.cgi?id=22742
 http://www.instantiations.com/codepro/ws/docs/preferences/preferences_editors.html
 
 


From: Stefan Xenos
Sent: Wednesday, October 13, 2004 12:45 PM
 . . . 
1. It is hard to get patches working between branches.
2. The CVS annotation view has become useless -- it always shows the last person to format the file, not the last person to actually change some line.
3. It is hard to track what was actually changed in a particular checkin, since the formatter causes changes throughout the file.
4. It is very hard to compare revisions.

Back to the top