7 ms·
Yeah, it can start some interesting conversations too - I don't care personally and tend to go with whatever autoformat in the editor uses. My view is that form
by problems 9y ago
Yeah, it can start some interesting conversations too - I don't care personally and tend to go with whatever autoformat in the editor uses. My view is that formatting code shouldn't be a human's job, adding linebreaks on long lines, spacing things out to exactly line up, etc is just a waste of my time.
That's the computer's job - it should do it based on human readability rules though, clang-format is probably the best example of these rules applied, it uses a TeX-style formatting engine for code.
- blazespin 9y agoWow, I am a spaces guy but honestly, didn't care this much. Clearly, I should! I mean, I would have failed that interview question totally. Except, I would have said whatever the team consensus was.
- jar3624 9y agocompletely agree with you. and i religiously autoformat my code before i read the code and just before i save the file. However it still amazes me how the majority of developers i work with either have no opinion on the topic or worse think this is a bad idea. some the reasons I've heard was it makes alot of changes to a file causing alot of diffs with previous version making it harder to figure was was actually changed, or they don't like they way its formatted .
- problems 9y agoI've been following this practice for a while, but never really thought much of mentioning it until I watched an interesting talk the other day: https://channel9.msdn.com/Events/GoingNative/2013/The-Care-and-Feeding-of-C-s-Dragons https://channel9.msdn.com/Events/GoingNative/2013/The-Care-a... In it, they mention an autoformatter as one of the best tools they gave their developers in terms of productivity gain and it really got me thinking about how this should be versus how it is in practice. There are some really bad autoformatters and some really good ones - find one that works and is configurable to match your standard and I think it really does result in a good productivity improvement.
- jdc0589 9y agocompletely agree, I'm also the (original) author of https://github.com/jdc0589/JsFormat https://github.com/jdc0589/JsFormat though, so I'm probably just more sensitive to formatting stuff in general.
- rdiddly 9y agoYep if you're going to convert from tabs to spaces or vice versa, please do a check-in/commit consisting only of that change before making any substantive code changes.
- tracker1 9y agoWas going to say the same... nothing wrong with a commit including only format changes... for that matter, add it as a task to the project, commit, run it, commit, then proceed to edit. If you have commit hooks setup, add it as a precommit hook/task. As long as it's relatively transparent for everyone to be able to use.
- patrickdavey 9y agoDoesn't that mean you make tools like git blame a whole lot less useful? I'm all for formatting my own code correctly, but I'm not going to nuke git history for a few spaces.