

Crockford on JavaScript — Scene 6: Loopage - potomak
http://www.yuiblog.com/blog/2010/08/30/yui-theater-douglas-crockford-crockford-on-javascript-scene-6-loopage-52-min/

======
culebron
This was the most useful episode of the series that I've seen. Basically,
before watching this I had no idea of the most fundamental feature of
Javascript, which is events loop and that only one function is executed at
time.

This means that you don't have to worry if any other data is updated while a
function works.

It also means that expensive code should be done as timeouts loop or some
other way, but not as a for loop, which blocks the browser or server
completely.

~~~
georgemcbay
Yep. All of what you said also applies to ActionScript (and haxe with an AS or
JS target) though not many Flash developers pay attention to that.

My code in these languages has evolved over the past few years from a pretty
standard serial C style pattern to one that makes use of "blocks", timers,
callback functors, continuations, lazy evaluations, etc because the perceived
performance in these environments is many times greater once you embrace this
style.

The downside is, you have to be really careful to structure your code to make
it understandable by others when you do things this way... even when you do a
good job, it can be much harder for other developers to really grok your code
than it would if you used a more traditional procedural/OO style because of
the non-linearity of it.

------
rafedb
imo this whole series is very good. I have noticed that just about any talk
that Douglas Crockford gives I either learn something new or have something I
knew a little bit become more solidified.

