Earlier quoted context omitted.
I think using comma-first syntax as a counter example is disingenuous. Whether you're a novice programmer or an expert programmer, using comma-first or comma-last isn't going to bite you in a way that isn't immediately solvable. Omitting semi-colons, however, can cause novice JavaScript programmers serious grief. Nevermind novice JavaScript programmers – they cause me grief, and I put semi-colons everywhere! That's b…
Whether you're a novice programmer or an expert programmer, using comma-first or comma-last isn't going to bite you in a way that isn't immediately solvable. Really? The comma first style makes it less likely that your list will end with a trailing comma, which can cause IE-specific bugs. If you're trying to track down the IE breakage a couple of weeks after you wrote down the code, it can be fun to track down the ex…
Best Practices Exist For A Reason
21–30 of 105 posts
Re: Best Practices Exist For A Reason
#22The main problem with appealing to "best practices" is this: One man's best practice is another man's anti-pattern. Between semicolon-free folks and JavaScript traditionalists, who gets to play the role of the expert? If Node.js is popular, does that mean that Isaac's comma-first style is "correct"? ( https://gist.github.com/357981 ) In the absence of a quantitative engineering method with which to evaluate either ap…
In the absence of a true quantitative engineering method, there is a middle ground other than personal choice: common anecdotes. Presumably, those shameful leaders have heard enough stories about the issue to make a reasonable recommendation, sort of like advising against shipping server software with an open default security strategy even though I don't have any peer-reviewed studies saying such is unwise.
Re: Best Practices Exist For A Reason
#23Earlier quoted context omitted.
Whether you're a novice programmer or an expert programmer, using comma-first or comma-last isn't going to bite you in a way that isn't immediately solvable. Really? The comma first style makes it less likely that your list will end with a trailing comma, which can cause IE-specific bugs. If you're trying to track down the IE breakage a couple of weeks after you wrote down the code, it can be fun to track down the ex…
With a decent language that allows trailing commas (eg. everything other than JS or SQL), it would never have been a problem in the first place.
It is an IE bug that causes it to break. One of the many ways they do not follow the spec.
Re: Best Practices Exist For A Reason
#24Earlier quoted context omitted.
Whether you're a novice programmer or an expert programmer, using comma-first or comma-last isn't going to bite you in a way that isn't immediately solvable. Really? The comma first style makes it less likely that your list will end with a trailing comma, which can cause IE-specific bugs. If you're trying to track down the IE breakage a couple of weeks after you wrote down the code, it can be fun to track down the ex…
What's harder, finding an extra trailing comma, or finding a missing semi-colon in a JavaScript file that contains no semi-colons?
Re: Best Practices Exist For A Reason
#25Earlier quoted context omitted.
Whether you're a novice programmer or an expert programmer, using comma-first or comma-last isn't going to bite you in a way that isn't immediately solvable. Really? The comma first style makes it less likely that your list will end with a trailing comma, which can cause IE-specific bugs. If you're trying to track down the IE breakage a couple of weeks after you wrote down the code, it can be fun to track down the ex…
With a decent language that allows trailing commas (eg. everything other than JS or SQL), it would never have been a problem in the first place.
Re: Best Practices Exist For A Reason
#26Earlier quoted context omitted.
Whether you're a novice programmer or an expert programmer, using comma-first or comma-last isn't going to bite you in a way that isn't immediately solvable. Really? The comma first style makes it less likely that your list will end with a trailing comma, which can cause IE-specific bugs. If you're trying to track down the IE breakage a couple of weeks after you wrote down the code, it can be fun to track down the ex…
You also gain a new possible bug--the leading comma.
Lists usually grow on the end, not the beginning.
(I use this kind of formatting for SQL, for a similar reason.)
Re: Best Practices Exist For A Reason
#27Earlier quoted context omitted.
Whether you're a novice programmer or an expert programmer, using comma-first or comma-last isn't going to bite you in a way that isn't immediately solvable. Really? The comma first style makes it less likely that your list will end with a trailing comma, which can cause IE-specific bugs. If you're trying to track down the IE breakage a couple of weeks after you wrote down the code, it can be fun to track down the ex…
With the comma first style, that bug would never have been introduced. Neat, huh? If you run any syntax checking or minification tools, this will be immediately obvious. If you test your site in IE at all, this will be immediately obvious. If you record JS errors on your site, this will soon be obvious. If you record any kind of usage statistic, this will eventually be obvious. Take it from someone who has experiment…
Re: Best Practices Exist For A Reason
#28That is some fairly brazen rhetorical sleight of hand. Schlueter is obviously not attacking the following of best practices. He is saying that semicolons-everywhere isn't a best practice and he gives an argument that the most common rationales given for the practice do not hold water. There are a few flaws with his argument, but what it certainly is not is a general condemnation of the following of actual, bonafide best practices.
Pretending otherwise is akin to accusing someone of "siding with the terrorists" because they argue that people should be allowed to take bottled water on airplanes.
Re: Best Practices Exist For A Reason
#29Contrast this with Python where the overarching rule is there should be one, and preferably only one, obvious way to do things.
Re: Best Practices Exist For A Reason
#30Earlier quoted context omitted.
With the comma first style, that bug would never have been introduced. Neat, huh? If you run any syntax checking or minification tools, this will be immediately obvious. If you test your site in IE at all, this will be immediately obvious. If you record JS errors on your site, this will soon be obvious. If you record any kind of usage statistic, this will eventually be obvious. Take it from someone who has experiment…
Indeed the link I gave demonstrates how the right IDE also solves this problem. The fact that there are many ways of solving the problem does not mean that it isn't a real problem that formatting can help address.