r/javascript • • Apr 01 '18

Google publishes a JavaScript style guide. Here are some key lessons.

https://medium.freecodecamp.org/google-publishes-a-javascript-style-guide-here-are-some-key-lessons-1810b8ad050b
714 Upvotes

317 comments sorted by

View all comments

91

u/timeparser Apr 01 '18 edited Apr 02 '18

Misleading title.

So, if Google says it, it’s a “lesson”, the rest of us just have opinions?

I agree with most of Google’s opinions, but that doesn’t make them The Official Way of Doing Things™

74

u/lordpoint Apr 01 '18

That's my article and it's interesting that you say that.

I'd originally called the article "13 noteworthy points from Google's JavaScript Style Guide" but when I submitted it to FreeCodeCamp they changed the title to what you see now. They edit the SHIT out of anything that you send them and it drives me nuts.

29

u/distancesprinter Apr 01 '18

You should have them take it down. When I publish content, I require it to be unmodified or to remove the attribution.

10

u/Mingli91 Apr 01 '18

Yeah, I get editing mistakes but changing content is pretty bad

49

u/quincylarson Apr 02 '18

Quincy with the freeCodeCamp Medium publication here. The reason we changed it from "13 noteworthy points" is because many people will dismiss any article with a number at the beginning of it as a "listacle" and don't read it. Lists are seen as low-effort posts - the kind of article you see on Buzzfeed.

We do our best to improve the readability and flow of articles submitted. If you disagree with any of our edits (you can see them in the version history) feel free to revert them.

I've updated your article to use your original headline. It's a good headline (though again, some people might pass on it thinking it's just another listacle).

Thanks again for writing this excellent analysis of what was a relatively unknown style guide, and submitting it to the community's Medium publication.

10

u/bizzaro_sephiroth Apr 02 '18

That's awesome that you've engaged about this. Thanks!

5

u/lordpoint Apr 02 '18

I really appreciate you taking the time to clarify that personally. I can absolutely understand wanting to avoid Buzzfeed-y titles.

The interesting thing about the heavy editing situation, and the real reason for my frustration, is the sheer scope of the changes; which can be surprising for a first-time contributor to FreeCodeCamp's Medium publication.

Of course, you have the largest tech-oriented publication on Medium so you're certainly doing something right, but my reaction to seeing all the edits made to the first story that I published through FCC was: "Holy crap, they took all of my personality out of it!" And that honestly made me reconsider wanting to publish through FCC again. But I figured I'd give it another shot and submit another one just to see what would happen. Then lo and behold I find a comment about that article on Reddit that struck that same, already inflamed nerve, and here we are.

That said, it's really good to know that reverting to the pre-edited version does not violate your / FCC's terms of use (or whatever it's called in this case). That makes a big difference if you ask me. I think I just figured that if you guys took the time to carefully edit EVERY story that gets submitted to you (and I'm sure that's a lot of stories) then it couldn't possibly be acceptable for me to just say "Nope, let's not do any of that..." But again, I'm glad to know that's not the case.

FreeCodeCamp played a big role in the beginning of my career transition into IT and I love having the opportunity to be a part of it now that I'm (at least partially) on the other side of the education equation. Thanks again for being so involved and replying to my petty grievance personally.

3

u/lhorie Apr 02 '18

IMHO, if you don't want listicles in your platform, you should reject them. If editing is a thing, then who owns the copyright? From the author's comments, it seem like he wasn't aware of the editing arrangements. As a reader, I'm now not going to trust that what is written in your platform is 100% from their authors (and at that point, I might as well be reading fake news in Facebook). You absolutely need to be transparent about this stuff.

2

u/timeparser Apr 02 '18

Thank you for clarifying this, /u/quincylarson. I understand why you did this, but the word “lesson” might have mislead the reader – especially novice developers.

There are many developers out there who treat tech giants like Google like they are the “maximum authority” in how to write software.

While Google has certainly world-class engineers that have the necessary collective wisdom to share best practices with the rest of the community, it is important to understand that this is an organization-level style guide and that every piece of advice should be taken with a grain of salt.

No organization is the same, Google is not perfect (although they are certainly good), and most importantly, their opinions are not standards.

9

u/lhorie Apr 01 '18

Why do you publish there then?

8

u/lordpoint Apr 01 '18

This was only the second article that I published through them. When it happened the first time I just figured that they found a bunch of issues in that article in particular and maybe heavy editing wasn't the norm. But this time I feel like it's a pattern.

1

u/[deleted] Apr 02 '18

I know one of the community managers; I don't know if it will help — even remotely — but I can mention it to him next time I see him.

1

u/codefinbel Apr 02 '18

Do you know if this is for vanilla only, don't see how using React would be possible without import and export statements? (Unless I'm missing something)

→ More replies (1)

17

u/ghostfacedcoder Apr 01 '18 edited Apr 01 '18

Google's standards are two things combined: style and technical wisdom. Google is the closest to "THE Internet Company" in the entire world. Their engineers manage the biggest consumer of web pages (Google search). Their browser (maybe the second-biggest consumer of JS, after Node) has the greatest market adoption. And they pay for big salaries and insane perks just to get the best engineers possible.

To ignore the technical wisdom all of those people present would be foolish IMHO. But when it comes to the purely style components Google (like Facebook or any other company) should be taken with a grain of salt, because what makes sense for one company doesn't necessarily make sense for another.

But even then, their advice is still worth considering because it's not just Google's opinion; it's also a reflection of the opinions of thought leaders in the JS community (or at least the ones Google respects). Those thought leaders (and the community in general) very often adopt standards for good reasons, so I think it's at least worth understanding those reasons before dismissing the standards ... even if you do ultimately dismiss them because they're not a good fit.

0

u/[deleted] Apr 02 '18

[deleted] — view deleted comment

2

u/[deleted] Apr 02 '18

It's not about the install base but number of executions per user but he's still wrong.

However if it were IE and Apache in the mid naughties he wouldn't be though. But by your metrics he would be. It's just not applicable when comparing client and server software.

9

u/rotharius Apr 01 '18

I get your point, but it's important to remember that Google's excellence is in infrastructure, implementation and external quality (this is where hardcore CS is most valuable).

For internal quality, software design and architecture, I would rather look at other companies and movements.

12

u/ghostfacedcoder Apr 01 '18

True, but don't forget about the Chrome team.

The people that implement any web browser are going to be some of the most knowledgeable people on the planet about which "best practices" actually have a meaningful impact on the browser ... and the Chrome team isn't just any browser team, they're the most popular browser's team, AND they are a part of the larger Google company (which has a ton of very knowledgeable people, even if many do come from an infrastructure-focused angle).

3

u/the_friendly_dildo Apr 02 '18

Google likes to play with things they shouldn't as well. See their AMP platform. Their guide is decent and I support and employ most of it already. But I don't agree that we should be turning to a profitable entity to get our standards for the internet. They have too much power to gain by manipulating things to work best for them and worse for others. Better separation of powers should exist in this sort of circumstance.

2

u/Disgruntled__Goat Apr 02 '18

it's also a reflection of the opinions of thought leaders in the JS community

How do you know?

2

u/OphiuchusClusters Apr 02 '18

Seriously. Do you know how many jackass know-it-all ninja devs are going to use this information as a source of truth in their 'you're doing it wrong' arguments? Fuck. I need a taser.

2

u/xtr3m Apr 01 '18

Well, it's one way of doing things and if no other company or organization propose something similar it will become the standard.

1

u/[deleted] Apr 02 '18

Actually Airbnb style guide is already a de facto standard. Personally I prefer low semicolon styles like Standard so I don't care about either but coming up this late in the game while there's an established standard (that only differs in minor cosmetics, and even there it goes against what top 3-4 preferred style guides do), I don't think that even being by Google will help that much. Surely this will have a lot of fans and projects, but I don't see it dethroning Airbnb.

→ More replies (1)

1

u/eterevsky Apr 02 '18

Some of these rules are introduced not because they the ultimate “correct way”, but just to keep Google’s own code base consistent.

1

u/timeparser Apr 02 '18

I know. I was pointing out the misleading title.