Nov 18 2008

On JavaScript

Published by david.humphrey under CDOT, Seneca

Last Thursday we were lucky to have my former student, Tom Aratyn, come and give a talk on JavaScript.  It was neat having Tom come to speak to this year’s crop of Seneca-Mozilla hackers, since he was literally the first student I had working on anything related to Mozilla.  Tom proved to me that students, and undergraduate students at that, could play at this level, and it’s been full steam ahead ever since.

I asked Tom to come and speak about extensions, since that’s what we’re studying right now.  Tom works fulltime as the lead developer at Security Compass, building security tools as Firefox Extensions.  He agreed to come, but told me he wasn’t going to talk about extensions, but about JavaScript instead.

I thought it was a fantastic idea.  By the time I get the students in their third or fourth year, they have taken at least 3 courses on C/C++, a few on Java and .NET, many web and scripting courses, etc.  In total the students have probaly learned and developed in no fewer than six programming languages.  “When I started working in JavaScript fulltime, I came to a point where I had to start over, and go read the ECMA spec.  Reading that, along with some papers about closures, I had an ‘aha!’ moment: JavaScript isn’t like anything else I’d learned before,”  Tom told me.

It really isn’t.  One of the language’s strengths is that it looks like something you’ve seen before, and becuase of that you are tempted to bring what you know about all those other curly-bracket languages.  JavaScript is plyable enough to let you do things you knew how to do before, inheritance for example.  It happily lets you do what you want, but leaves subtle hints that you might want to do something else, that you might need to think differently.

Steve Yegge wrote an interesting post recently about his work to write a JS interpreter in emacs, and one quote toward the end really resonated with me:

…JavaScript is a language that smart people like. It’s weird, but I keep meeting really really smart people, folks who (unlike me) are actually intelligent, and they like JavaScript. They’re always a little defensive about it, and almost a little embarrassed to admit it. But they think of it as an elegant, powerful, slightly flawed but quite enjoyable little language.  I tell ya: if you’re a programming language, it’s a very good thing to have smart people liking you.

I’ve had this exact same feeling for a long time, not coincidently the same period I’ve been working closely with people at Mozilla.  This is a somewhat long way to get to my original intent in writing this, which was to share a link to a great post by Mozilla’s Jason Orendorff, who works on SpiderMonkey (Mozilla’s JavaScript engine).  Jason does a great job describing from the bottom-up what Tom was talking about from the top-down, specifically looking at how the scope chain works.

Tom’s talk got me reflecting on the fact that we really need a proper course on JavaScript, one that teaches the language as it really is.  We already have two full courses that teach these students to hack on Mozilla, Firefox, Thunderbird, etc.  Why not take it to the next step?  I think a final year option course on JS and the Open Web is something that needs serious thought, and I’m already thinking…

No responses yet

Nov 16 2008

10K Hours

Published by david.humphrey under CDOT, Idea Factory, Seneca

I’m not usually a great fan of Gladwell’s books, but tonight I happened upon this excerpt from his latest book, which asks the question of whether there is any such thing as a genius.  It’s a fascinating read, and dovetails with a number of other conversations and philosophical ideas I’ve been preoccupied with lately.  One of his points, and the one I found most interesting, is that success–the success of a great hockey player, a programming elite like Bill Joy or Bill Gates, or a virtuoso violinist–is very much a function of time spent practicing:

If you put together the stories of hockey players and the Beatles and Bill Joy and Bill Gates, I think we get a more complete picture of the path to success. Joy, Gates and the Beatles are all undeniably talented. Lennon and McCartney had a musical gift, of the sort that comes along once in a generation, and Joy, let us not forget, had a mind so quick that he could make up a complicated algorithm on the fly that left his professors in awe. A good part of that “talent”, however, was something other than an innate aptitude for music or maths. It was desire. The Beatles were willing to play for eight hours straight, seven days a week. Joy was willing to stay up all night programming. In either case, most of us would have gone home to bed. In other words, a key part of what it means to be talented is being able to practise for hours and hours - to the point where it is really hard to know where “natural ability” stops and the simple willingness to work hard begins.

He goes so far as to give the length of time it takes:

This idea - that excellence at a complex task requires a critical, minimum level of practice - surfaces again and again in studies of expertise. In fact, researchers have settled on what they believe is a magic number for true expertise: 10,000 hours.

Earlier today I had a conversation that repeats in my professional life a lot.  One of my students pinged me on irc to say that he was 10 hours into trying to solve a hard problem, and needed some advice.  My advice in these cases is usually the same, and often has little to do with computers: I told him to keep going.  He did, and two hours later he was back with the working code.  Despite how he feels tonight, having gotten it done, and submitted the work, the code is almost irrelevant.  Ten years from now he won’t remember the program at all.  What’s most important here is that there’s only 9,988 hours left, probably a lot less.

7 responses so far

Nov 14 2008

Doesn’t everyone do it like this?

Published by david.humphrey under CDOT, Seneca

I’ve been fixing bugs all week as I gear-up for a new round of marking on the students’ 0.2 releases.  It’s been a welcome change hacking my email application (Thunderbird) instead of spending all day replying to mail inside it.

Whenever I can I try to practice what I preach, and since I preach “open source bug fixing,” it only makes sense for me to get my hands dirty as often as I can.  Every time I do, I learn something new about the process, about open source, and about programming.

Today, as I wait for bugzilla to come back on-line so I can work on my bugs, I have a minute to make an observation.  I’ve spoken in the past about what it’s like to work at scale with a project such as Mozilla.  Yesterday I was reminded of this again, but for a different reason: Mozilla has a lot of users, and with lots of users comes lots of different/competing ways of using the same things.  My patches this week have almost all hit, “but what about my-important-edge-case?” comments from people.  It’s amazing how we can all take the same program and use it in such different ways.

To really make my point I thought I’d quote Mozilla’s Robert O’Callahan (roc) who was bemoaning the same thing on irc last night:

21:15 < roc> argh
21:16 < roc> now we’re discussing the linebreaking rules for when Chinese is quoted in German.

It’s so different working on something big that a lot of people care about.

No responses yet

Nov 12 2008

Fire Tweet

Published by david.humphrey under CDOT, Mozilla, Seneca

Here’s a thought: why don’t the buildbots report to Twitter?  If the mars lander can twitter, why can’t the Mozilla tree?  It would be cool to have it report with some wit:

“Um, John Smith, you totally broke the tree! [links]”

Why not?

5 responses so far

Nov 12 2008

Sayings

Published by david.humphrey under Digital Swag

I collect sayings.  Not physically, but in my head.  I’ve done so all my life, and it’s something I enjoy no end.  In the past two days I’ve stumbled on two great ones, and I offer them here as a way to enjoy them more fully as I take the time to type them out:

“We got on like a house on fire.”

“He realized that this was about as likely to be good as fried snowballs.”

Perfect.

No responses yet

Nov 12 2008

Make it go zOOom

Published by david.humphrey under CDOT, Seneca

As Fardad gears up to start teaching OpenOffice.org development in the winter, he’s doing a bunch of work on the code right now.  What he’s finding is that OOo builds are slOOow, like 8 hours slow for a clobber build.  Yesterday, as I walked past all our quad-core machines in CDOT, it occured to me: we should really get a compile farm setup.

Since a bunch of my students were looking for contribution opportunities yesterday in class, I thought I’d blog and say that this is a great chance to get some contrib marks.  Probably the simplest thing we can do here is setup distcc and ccache on these boxes so that builds automagically get distributed across our fast build machines.

Get in touch with me/Fardad if you want to work on this.  It’s not hard, and it will help us all a lot.

No responses yet

Nov 11 2008

I Remember - Dulce Et Decorum Est

Published by david.humphrey under Idea Factory

Bent double, like old beggars under sacks,
Knock-kneed, coughing like hags, we cursed through sludge,
Till on the haunting flares we turned our backs
And towards our distant rest began to trudge.
Men marched asleep. Many had lost their boots
But limped on, blood-shod. All went lame; all blind;
Drunk with fatigue; deaf even to the hoots
Of disappointed shells that dropped behind.

GAS! Gas! Quick, boys!– An ecstasy of fumbling,
Fitting the clumsy helmets just in time;
But someone still was yelling out and stumbling
And floundering like a man in fire or lime.–
Dim, through the misty panes and thick green light
As under a green sea, I saw him drowning.

In all my dreams, before my helpless sight,
He plunges at me, guttering, choking, drowning.

If in some smothering dreams you too could pace
Behind the wagon that we flung him in,
And watch the white eyes writhing in his face,
His hanging face, like a devil’s sick of sin;
If you could hear, at every jolt, the blood
Come gargling from the froth-corrupted lungs,
Obscene as cancer, bitter as the cud
Of vile, incurable sores on innocent tongues,–
My friend, you would not tell with such high zest
To children ardent for some desperate glory,
The old Lie: Dulce et decorum est
Pro patria mori.

(Wilfred Owen)

No responses yet

Nov 09 2008

Return of the White Whale

Published by david.humphrey under Idea Factory, family

Last night at dinner my girls got us talking about octopai, which led to cuttlefish, which led to squid and giant squid.  Well, it wasn’t long until we were talking about Sperm Whales, at which point it was pretty much a foregone conclusion that I’d be reading Moby Dick after I got them to bed.

I haven’t read it since grad school, where we studied it as part of a course on the Bible and Literature.  I had a prof who, given the chance, used anything he could by an American author–how we made it through a full course on the Bible and Lit without dealing with Frye I’ll never know.  Sux 2 B CanLit.

If you’ve never read it, it’s not at all what you think.  I’ve always loved the book as one of the greatest examples in literature of a highly technical book that also embraces narrative.  Where Homer loved his descriptions of sheilds, Melville wants you to know that rigging, harpoons, and everything else to do with whaling is worth knowing.  Along the way the sermons, Platonic philosophizing, lust for revenge, and story of the scariest creature the world has ever known will hold you breathless.

It’s that good, and I’m happy to have found an occasion to read it again.  Thank goodness for cephlopods!

No responses yet

Nov 07 2008

Context and Correction

Published by david.humphrey under family

While I wait for a build to finish, I have time to share a story about something I learned yesterday.  First, I have to gloat: our girls are reading!  It’s been incredible to watch them suddenly get it, and become ravenous readers (”Dad, what does it say on the bottom of your socks?  I thought I saw some letters”).  We’ve been reading books together, especially at night in bed, and it’s one of the most enjoyable times of the day as a result.

I have to take a lot of credit for their learning to read–I married the right woman!  My wife has spent countless hours with them slowly teaching them how to read.  Homeschooling is amazing for many reasons (I need to talk about them sometime), but one of them sticks out above the rest: when things happen, you’re there to experience it with them.  Learning doesn’t just happen during the “school day;” it’s always happening, and the eureka! moments are strewn amongst otherwise mundane activities.

Much like parenting in general, homeschooling is an invisible career: no one notices that you’re doing all that work, and when things happen people say things like, “Wow, aren’t they smart.”  The truth is that this stuff just takes a ton of work, and my wife has done an amazing job getting them to this point.

So last night before bed, I was reading with our oldest daughter.  It was a story about a horse, and each page had two sentences.  As she moved through the first sentence, she got a word wrong, swapping the tense as she guessed vs. read it.  For some reason I didn’t correct her right away as I had been.  Probably I was getting tired.  As she read the next sentence, she inevitably came to a point where the word she’d read earlier didn’t make sense, at which point she went back and corrected herself.

My problem is that I assume that since she’s learning to read, she’s thinking in terms of individual words.  That’s sort of true, since she’s sounding things out, and going letter-by-letter and word-by-word.  But, for years she’s been steeped in language, and gets its subtlties.  She understands the context already, and reading is more a mapping into a system she already has, than something totally new and undiscovered.

As my daughters learn to read, I learn a lot about how to learn, and how not to teach.  We’re both making incredible progress.

No responses yet

Nov 07 2008

Change might need to change

Published by david.humphrey under Come on!, Seneca

Like most people I know, I’m thrilled that Change has come to the US.  I’ve been somewhat obsessed with US politics of late, following it on-line via blogs, twitter, youtube, and such.  I think one of the most emotional moments for me was watching a video of Obama vote with his family.  I have two daughters as well, and we took them to vote with us in the recent Canadian election.  What he’s accomplsihed is really something amazing, and I have to say that I’m proud of our neighbours to the south once again for getting this one so right.

Now, let me ask a question.  Today I see http://change.gov has launched, which is a fantastic idea, and really a smart way for such a participatory campaign to continue working after the election is over.  Being a technology guy, I had a look at their plans for Technology, and was met with this nugget:

Protect American Intellectual Property Abroad: The Motion Picture Association of America estimates that in 2005, more than nine of every 10 DVDs sold in China were illegal copies. The U.S. Trade Representative said 80 percent of all counterfeit products seized at U.S. borders still come from China. Barack Obama and Joe Biden will work to ensure intellectual property is protected in foreign markets, and promote greater cooperation on international standards that allow our technologies to compete everywhere. [ed. emphasis mine]

Why am I being quoted MPAA piracy stats by the President-Elect?  Is this really where he’s going for his information?  That’s not much of a change, if change is what we’re after.

UPDATE: David Ascher has some other interesting observations on this.

3 responses so far

Next »