Earlier quoted context omitted.
With all due respect, Crockford jumped the shark some time ago.
In what sense?
Javascript the right way
21–30 of 43 posts
Re: Javascript the right way
#22Looks more like JS the java way. Singletons make no sense in a language that has global variables and never lets you stop an object from being duplicated. The command pattern makes no sense in a language with first-class functions. I'd steer clear of this resource if you want to write javascript the right way.
Re: Javascript the right way
#23Looks more like JS the java way. Singletons make no sense in a language that has global variables and never lets you stop an object from being duplicated. The command pattern makes no sense in a language with first-class functions. I'd steer clear of this resource if you want to write javascript the right way.
I somewhat agree with your points. You can't just explain every single design pattern available in any given language and then say, you now know how to write that language "The right way!". Thats the feeling I got from this, it just goes into way too much detail about way too many things, and forgets to start with the basics, which is all you need to know to write JavaScript the right way. How can you write any langu…
Re: Javascript the right way
#24Looks more like JS the java way. Singletons make no sense in a language that has global variables and never lets you stop an object from being duplicated. The command pattern makes no sense in a language with first-class functions. I'd steer clear of this resource if you want to write javascript the right way.
Global variables are irrelevant since your global namespace most likely resembles a tree structure.
edit: you may be right about the command pattern, I've never used something like that. It may just be the example is half-assed though.
Re: Javascript the right way
#25Looks more like JS the java way. Singletons make no sense in a language that has global variables and never lets you stop an object from being duplicated. The command pattern makes no sense in a language with first-class functions. I'd steer clear of this resource if you want to write javascript the right way.
In JS, a singleton is a reference to a module. It is used to ensure you invoke the module only once. Global variables are irrelevant since your global namespace most likely resembles a tree structure. edit: you may be right about the command pattern, I've never used something like that. It may just be the example is half-assed though.
Re: Javascript the right way
#26Looks more like JS the java way. Singletons make no sense in a language that has global variables and never lets you stop an object from being duplicated. The command pattern makes no sense in a language with first-class functions. I'd steer clear of this resource if you want to write javascript the right way.
I somewhat agree with your points. You can't just explain every single design pattern available in any given language and then say, you now know how to write that language "The right way!". Thats the feeling I got from this, it just goes into way too much detail about way too many things, and forgets to start with the basics, which is all you need to know to write JavaScript the right way. How can you write any langu…
Re: Javascript the right way
#27Looks more like JS the java way. Singletons make no sense in a language that has global variables and never lets you stop an object from being duplicated. The command pattern makes no sense in a language with first-class functions. I'd steer clear of this resource if you want to write javascript the right way.
Care to point us to some better resources?
Eloquent JavaScript, a freely available book with an in-browser REPL and a lot of fun exercises
http://eloquentjavascript.net/
Douglas Crockford's JS master class, which covers a lot of the same material as his "JavaScript: the Good Parts" but in video format, and I think in a much more digestible way. The Good Parts book is very, very dense and probably best used as a reference. (why he thought starting with a formal definition of the langauge's grammar was a good idea completely escapes me)
http://shop.oreilly.com/product/9780596809614.do
I don't actually know if these are really up-to-date, and all the cool kids are using CoffeeScript anyway, so anyone with more experience please correct me if these aren't any good. They definitely point out how to avoid the most painful quirks of the language, and how to leverage the core that is actually decent.
Re: Javascript the right way
#28Earlier quoted context omitted.
In JS, a singleton is a reference to a module. It is used to ensure you invoke the module only once. Global variables are irrelevant since your global namespace most likely resembles a tree structure. edit: you may be right about the command pattern, I've never used something like that. It may just be the example is half-assed though.
There are no modules in JavaScript as well. At least not in ES5.
Re: Javascript the right way
#29Please, feel free to fork the project and send a pull request, we really want to make this guide a reference for JavaScript developers.