News for hackers. Stuff that matters.
Re:Enterprise Javascript is... by dejv on Tuesday October 19, 2010 @08:23AM (#1806848)
This one is best: http://enterprise-js.com/16
Re:Enterprise Javascript is... by rimantas on Tuesday October 19, 2010 @09:14AM (#1806986)
Usage shown in example is stupid. However to present this approach as antipattern is also stupid. If "enterprise" means even moderately big apps namespacing is the way to go. Alas, that project mocks too much useful stuff to be liked by me.
Re:Enterprise Javascript is... by DougWebb on Tuesday October 19, 2010 @09:50AM (#1807087)
Namespacing seems fine, but to torture the declaration syntax as shown on the site in order to get the Java-like com.domain.package.class.method() syntax is wrong. Just use underscores in the name rather than periods and use the syntax properly.
Re:Enterprise Javascript is... by toolate on Tuesday October 19, 2010 @08:13PM (#1809397)
Not to mention, the next library you load will clobber the `com` variable.
Re:Enterprise Javascript is... by latentflip on Tuesday October 19, 2010 @09:33AM (#1807032)
That's the first example I got when loading the page, and that's exactly what I thought: for big projects namespacing seems sensible enough. So I thought the site was a collection of design patterns, rather than anti-patterns.

Left me very confused when the next example was declaring all your functions globally.

Re:Enterprise Javascript is... by vog on Tuesday October 19, 2010 @09:57AM (#1807124)
Still, two levels of namespaces are more than enough.
Re:Enterprise Javascript is... by dchest on Tuesday October 19, 2010 @09:06AM (#1806965)
Feels like Google's Closure Library.
Re:Enterprise Javascript is... by swolchok on Wednesday October 20, 2010 @08:03PM (#1813676)
Closure doesn't do it that way, and the Closure Compiler will collapse the namespacing so that it doesn't result in runtime overhead.
Re:Enterprise Javascript is... by dfj225 on Tuesday October 19, 2010 @11:44AM (#1807503)
Also, YUI.
Re:Enterprise Javascript is... by grayrest on Tuesday October 19, 2010 @02:50PM (#1808259)
YUI2. yui3 is considerably more sane about the namespacing.