Live data from Hacker News

Front End Development Guidelines

taitems.tumblr.com

11–20 of 51 posts

Re: Front End Development Guidelines

#11
I disagree on the usage of double quotes over single quotes for strings. Single quotes are useful when the string contains HTML.

The Google JavaScript Style guide recommends single quotes over double quotes for this reason:

http://google-styleguide.googlecode.com/svn/trunk/javascript...

Re: Front End Development Guidelines

#12

I disagree on the usage of double quotes over single quotes for strings. Single quotes are useful when the string contains HTML. The Google JavaScript Style guide recommends single quotes over double quotes for this reason: http://google-styleguide.googlecode.com/svn/trunk/javascript...

It's interesting that Google and jQuery seem to disagree on this as per: http://docs.jquery.com/JQuery_Core_Style_Guidelines#Strings

I'm yet to see a compelling argument for either. My original paragraph for string creation forgave C style strings, as they do seem very clean cut and easy to identify. I think this is an area that needs some debate.

Re: Front End Development Guidelines

#14
post #13

I find Avoid Comparing to true and false a little pedantic and can someone explain how it is "... bad as it's ambiguous"?

I'll put my hand up for that mistake. I think the word I was looking for was "redundant", and not "ambiguous". Following the other concept of prefixing your booleans with "can" "has" and "is", your variable names should be self explanatory.

if (isSelectable === true) { ... }

versus:

if (isSelectable) { ... }

It's a shorthand method, similar to why you would use int++; instead of int = int + 1;

Re: Front End Development Guidelines

#15
post #12

I disagree on the usage of double quotes over single quotes for strings. Single quotes are useful when the string contains HTML. The Google JavaScript Style guide recommends single quotes over double quotes for this reason: http://google-styleguide.googlecode.com/svn/trunk/javascript...

It's interesting that Google and jQuery seem to disagree on this as per: http://docs.jquery.com/JQuery_Core_Style_Guidelines#Strings I'm yet to see a compelling argument for either. My original paragraph for string creation forgave C style strings, as they do seem very clean cut and easy to identify. I think this is an area that needs some debate.

I think the idea is that if you use single quotes for strings, you don't have to escape the double quotes that are often found in html. 'something

'

But the same goes for something like "you can't do that"

I guess it just depends what you don't want to escape. For Google, the more probable scenario was probably the former.

Re: Front End Development Guidelines

#17
post #16

Its better to link directly to the source, not a blog. http://taitems.github.com/Front-End-Development-Guidelines/

I did that below as the first comment.

I was keen to write a foreword explaining that I am self-taught, so there are going to be shortcomings in my theory knowledge - as I never did a CS degree. It was to mitigate the shread-tearing I expected to receive in the comments section of HN ;)

Re: Front End Development Guidelines

#18
This is good, but some of the advice isn't quite right. For instance "self" is a reserved keyword in JavaScript, so often people use "_self" instead. And camel casing variable names is right, unless they're constants, in which case "THIS_IS_A_CONSTANT" is more appropriate. Too nit picky?

Re: Front End Development Guidelines

#19

This is good, but some of the advice isn't quite right. For instance "self" is a reserved keyword in JavaScript, so often people use "_self" instead. And camel casing variable names is right, unless they're constants, in which case "THIS_IS_A_CONSTANT" is more appropriate. Too nit picky?

Nope, exactly the type of feedback I'm after. Thanks a lot!

Re: Front End Development Guidelines

#20

This is good, but some of the advice isn't quite right. For instance "self" is a reserved keyword in JavaScript, so often people use "_self" instead. And camel casing variable names is right, unless they're constants, in which case "THIS_IS_A_CONSTANT" is more appropriate. Too nit picky?

And there's those of us who prefer lowercase unix_case_for_variable_names and function names over camel case.
Post reply on HN