6 ms·
I honestly love that Go has a formatter included, and the style is specified. Similarly with black[0] for Python. I used to care terribly about style, until I r
by npsimons 6y ago
I honestly love that Go has a formatter included, and the style is specified. Similarly with black[0] for Python. I used to care terribly about style, until I realized I just care about consistency and readability. Otherwise I don't give a shit, and having a tool available to everyone makes such a difference. This goes for other tools too, like static checkers, linters, even CI. I've been on projects where anyone could run the whole CI pipeline (which included the aforementioned static checkers, unit tests, even a doxygen run to check for undocumented things) on their dev machine before submitting, and not waste anyone's time with things better done by a computer. Wish every project could be like that.
[0] - https://black.readthedocs.io/en/stable/ https://black.readthedocs.io/en/stable/
- aequitas 6y ago> I used to care terribly about style, until I realized I just care about consistency and readability. Otherwise I don't give a shit, and having a tool available to everyone makes such a difference. I had the same thing. Also consistency and automation is what's really important, as it extinguishes every need for style discussions. Because you can trivially convert from the project style to personal styles and vice versa using things like Git attributes[0], as long as it is consistent. [0] https://git-scm.com/docs/gitattributes https://git-scm.com/docs/gitattributes
- FalconSensei 6y agoyeah, same with me. That's why I love prettier. I care more about just having a pattern that's applied automatically, than I care about personal preferences.
- musingsole 6y agoConsistency for consistency's sake is not a virtue. The best solution to all the style discussion nonsense is an automated, mandated style. The better solution is the team being mature enough to only care about real problems and not gate development with personal preferences. There's something to be said for feeling comfortable in your space. The company's codebase is not your space.
- npsimons 6y agoConsistency for readability is a virtue; did you miss that part? And it's not about "gating" development with "personal preferences", what a strawman. If someone can't be bothered to run the formatting tool included in the repo on their code before submitting, then I can't be bothered to review their submission. > The best solution to all the style discussion nonsense is an automated, mandated style. Yes, exactly what I said. Again, did you miss that?
- markrages 6y agoConsistency doesn't always serve readability. In written English, you can convey the same basic facts with a hundred different sentences. A good author will choose the one that best conveys emphasis and subtle gradations of meaning to the attentive reader. Code is also written for humans to read, so the best written code will use all the available facilities of the language to convey meaning to the reader.
- makapuf 6y agoExactly Like english or any written language, generally books are typesetted against a bunch of general conventions. You dont choose if you get one or two spaces after a semicolon. Your book is not great because you wrote it in leetcase, you focus on the meaning, not the details.
- musingsole 6y agoYou really do get to choose if you want 1 or 2 spaces or whatever formatting you want. Certain publishing houses might have style guides that they follow strictly and others less so, but all this just makes the formatting for a book a perfect metaphor to formatting code.
- tharkun__ 6y agoYou don't. The consistency is within the same book (or maybe publisher). A book would look ridiculous if every paragraph was using a different number of spaces after punctuation. But between two books its just personal preference whether you agree with the choice the author/publisher made.
- rkuykendall-com 6y agoFor JS/TS/etc, Prettier: https://prettier.io/ https://prettier.io/ I don't agree with all the formatting, but I also just don't care enough. It's sooooo nice running `yarn format` on a huge legacy codebase after adding prettier.
- zmmmmm 6y agoughh ... I've never seen HTML code uglier or harder to read than what came out of prettier on the code bases we have that it is used on.
- brobinson 6y agoThe fact that gofmt removes whitespace between arithmetic operators drives me insane. Fortunately, rustfmt and black don't do that, and I've been largely able to avoid writing Go for the last year now.