March 19, 2010

There is Brilliance in this Language

Douglas Crockford, speaking about Javascript, explains why the vilified language is actually full of brilliant features and has "much more expressive power than the classical system." He also gives an entertaining view of the history of web programming, which roughly traces the timeline of my personal experience, from HyperCard to NCSA to Netscape to IE to Google.

Worth a watch. (mp4 wmv other)

I have been thinking that Javascript is really the right first programming language for kids to learn. I might give it a try with a little group of kids this spring. Any advice?

Posted by David at March 19, 2010 07:01 AM

By the way, Doug mentions cryptically that although it the decision to having only a single Number type in Javascript was brilliant, the choice of type as IEEE-754 binary64 "double" was unfortunate, because its need to approximate 0.09 as 0.08999999999999997 is confusing for programmers who are counting money.

Perhaps a binary-coded decimal system such as IEEE-754 "decimal64" might have been a better choice. What do you think?

Posted by: David at March 19, 2010 08:32 AM

Hm? What happened to Python being the right first programming language?

I have never tried Javascript before, but I'm picking up C++ pretty quickly as a first language, using the guides on

I've also used your articles about teaching Anthony to use Python to learn a bit about it, but never got into it much.

Posted by: Daniel at March 22, 2010 09:10 PM

Python is the best learning language! It is far more readable and accessible than other languages. And it's used by professionals - it is real.

But after some time on python, my son got to the point where he wanted to show off his programs to his friends. When I had to explain that his friends would have to install python to run his programs, and that they couldn't just play with them on the web like you can do with any Flash game, he was disenchanted.

Even for a kid, Distribution is King.

We spent a little time looking at programming in Flash. But that's hard and requires pricey tools (or clunky open-source ones). On the other hand, Javascript-in-the-browser very accessible. Particularly if you add in a standard library like jQuery to smooth out the DOM, it's not really horrible at all.

Now my challenge is to figure out what the right "first 10 programs" for a Javascript kid should be.

Posted by: David at March 23, 2010 03:39 PM

Shakeing windows with moveTo(), escaping buttons and other pranks!

Posted by: Olev at March 23, 2010 08:58 PM

IEEE 754-2008 decimal floating point numbers make a lot more sense for general-purpose computing than IEEE 754-1985 binary floating point. In fact, William Kahan (the discrete math expert brought in to help Intel design the x87 floating point unit) initially suggested a decimal format, but by the time he was consulted, Intel's design was already too far along for such a radical change. Kahan's x87 work formed the basis for the IEEE 754-1985 floating point standard.

I wish Python, Lua, Ruby, and especially Javascript, had chosen to use decimal floating point numbers as their default floating point types.

Yes, there are some advantages in binary floating point if you're doing large scale fluid dynamics, particle physics, or other hard-core numerical simulations. However, binary floating point has left the world with too many subtly wrong calculations involving money. I appreciate the elegance of IEEE 754-1985, and I can encode and decode simple cases in my head, but I've also seen too many programmers (and non-programmers writing spreadsheets) make rounding mistakes that they wouldn't have made using IEEE 754-2008 decimal numbers.

I really wish Microsoft had switched to decimal floating point for the .xlsx spreadsheet file format (and gotten the 1900-is-a-leap-year monkey off their back). Old spreadsheets would have worked just as they always did, and new spreadsheets would have been less dangerous for the unwary. Those who really knew what they were doing could always have saved in the legacy format to get the binary floating point behavior.

Posted by: Karl Magdsick at July 22, 2013 01:53 PM

David: py2exe and p2app allow packaging up Python applications as (somewhat large) single Windows binaries or single OS X applications, including the Python virtual machine and any Python libraries used by the app. That way, it's not necessary for the user to install Python in order to run your son's Python program. The cost is distribution size.

Posted by: Karl Magdsick at July 22, 2013 08:05 PM
Post a comment

Remember personal info?