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.
[ Parent
| on HN ]
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.
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.