3 ms·
Agreed - I think he has improved people's perception about JavaScript, but people who blindly follow what Crockford says are worse than the copy-paste javascrip
by stephenr 15y ago
Agreed - I think he has improved people's perception about JavaScript, but people who blindly follow what Crockford says are worse than the copy-paste javascript developers of the late 90s.
I too disagree with him about several things - these two off the top of my head:
* White space - real tabs are much easier to work with than spaces
* new Operator - a) we can automagically return a new instance if the constructor is called normally and b) even if we couldn't, that's no reason to stop using a major part of OOP.
- barkmadley 15y agoFor me, the new operator (in javascript) is an optimisation, so it should be inserted into a code base after profiling. In accordance with the "make it work, make it right, make it fast" philosophy of development.
- lawnchair_larry 15y agoThe anti-tab movement is not specific to Javascript. Most languages have adopted this position, and most IDEs expand tabs to spaces by default now.
- aaronharder 15y agoBut why that pro-space bias? I've always preferred tabs.
- mattmanser 15y agoBecause different editors handle them wildly differently but spaces are totally unambiguous. With spaces there's no sudden, 'woah, what happened there'.
- __david__ 15y agoBecause there are times when you need to indent to something that isn't a main indentation point, like this: some_function_with_too_many_args(some_argument, another, a_third, and_so_on); That style is problematic with tabs. The only way to make that look right with all different tab settings (8, 4, 2, etc) is to mix tabs and spaces--indent to the main indentation level with tabs and then use spaces to indent the rest of the way. Not many editors do that automatically for you and so it is not a popular style. All spaces is much easier to deal with (at the cost of being non-customizable) and so that seems to be the dominant way of doing things nowadays.