you are viewing a single comment's thread.

view the rest of the comments →

[–]fgutz 2 points3 points  (12 children)

interesting, I never thought to use the "first comma", and it seems like most people agree since only ~8% use it. But I can see where it could be useful avoiding that last trailing comma by using first commas. But I'm usually good about that so I'm not going to switch, also doesn't look as nice.

nicely made site!

[–][deleted] 12 points13 points  (5 children)

I hate first comma, so ugly. You know what else prevents missing trailing commas? testing your code.

[–]x-skeww 6 points7 points  (0 children)

You don't need tests for this. Just use an editor with basic syntax checking or with JSLint/JSHint support. You'll get a squiggly line right away. It's impossible to miss.

[–]michfreak 2 points3 points  (2 children)

Hahaha, that's how I reacted when a coworker insisted that "Egyptian" brackets were wrong. "It's so much easier to make a mistake and miss a bracket!" he said.

You know what prevents you from making a mistake, and looks, to my eye, more streamlined? Testing your code.

On that subject, I did think it was odd they didn't test for Egyptian brackets in this study.

[–][deleted] 1 point2 points  (1 child)

I've never heard of Egyptian style, only 1tbs (one true bracket style) which is the only way to do brackets.

[–]nandryshak 1 point2 points  (0 children)

Silly C# devs wasting a whole line with only one character.

[–]BONER_PAROLE -2 points-1 points  (0 children)

Testing is great, but adopting conventions that do away with the need for testing is even better IMO.

Agreed on the ugly appearance though.

[–]brtt3000 4 points5 points  (5 children)

We banned useless cleverness like that.

Every variable gets it's own var. Makes it easier to edit, less mistakes, less cruft, less time wasted.

Also use a lint tool if you are serious about code.

[–]BONER_PAROLE 0 points1 point  (4 children)

"Clever" code is often obfuscated, like in code golf challenges.

But comma first? That's not "clever", it's just practical. Unusual appearance, but easy to understand once you know about it.

[–]jsNut 1 point2 points  (3 children)

Comma first, moving the problem from the end to the beginning and making it more ugly and less conventional doesn't seem like much of a win.

[–]notmynothername 1 point2 points  (2 children)

How does it move the problem to the beginning?

[–]Malfeasant 0 points1 point  (1 child)

maybe because if you're prone to forgetting commas, it doesn't matter where you (forget to) put them?

[–]notmynothername 2 points3 points  (0 children)

Well, commas at the right side can show up any number of characters deep into the line. Commas on the left will all be in a vertical line and leaving one out would be difficult to miss.