News for hackers. Stuff that matters.
Re:Advanced JavaScript Techniques by solutionyogi on Friday October 09, 2009 @01:21PM (#871941)
Pardon me, but what's so advanced about these techniques? Anyone writing JavaScript for living should already know these things. You want to talk advanced? How about lazy function definition [http://peter.michaux.ca/articles/lazy-function-definition-pa...]? Or say actual advanced JavaScript? http://ejohn.org/apps/learn/
Re:Advanced JavaScript Techniques by howardr on Friday October 09, 2009 @01:45PM (#872019)
Although it is helpful to the very junior developers at my company, the techniques are by no means "advanced." I suggest he change the title to "Javascript Basics Everyone Should Know."

It's not a terrible article, and he doesn't have bad advice, but as someone else points out in another comment he makes some pretty rookie mistakes (new Objects() instead of {})...

Re:Advanced JavaScript Techniques by slice on Friday October 09, 2009 @02:13PM (#872086)
The lazy function technique can easily become an example of bad coding practice. Code needs to be easy to read, understand, and maintain. In most cases solution 2 is good enough, in all cases it's much simpler.

Advanced techniques should only be used when there is a clear justification to sacrifice simplicity. It is disastrous when developers use so-called "advanced" technique only to entertain themselves and show-off.

You are judged not by the niftyness of your code, but by the availability, maintainability, stability and functionality of your system as a whole.

Re:Advanced JavaScript Techniques by kls on Friday October 09, 2009 @02:50PM (#872174)
Code needs to produce predictable results without bugs. All other qualities are secondary. Good code without bugs is well encapsulated and should work as a black box. Elegance is secondary to reliability. I am not saying that it is not important, just not as important as reliability. As a general rule of thumb less lines of code translates into higher reliability. I know it does not apply to every case but it is a good starting point.
Re:Advanced JavaScript Techniques by slig on Friday October 09, 2009 @02:14PM (#872089)
Thanks for the ejohn's link. I've been reading his new book, and this pretty much all the code that he shows there. (as far as I've read)
Re:Advanced JavaScript Techniques by n-named on Friday October 09, 2009 @01:38PM (#871997)
There's also an issue with his myMethodValue. It's actually a global variable (try alert(window.myMethodValue). He should have used var myMethodValue within the function definition.