An Interview with Dean Edwards

Dean Edwards was kind enough to answer a few questions on JavaScript.

Tell me a bit of your background and how you got into JavaScript programming?

I’ve been a programmer (professionally) for twenty years. Most of that time I’ve been a GUI builder using things like the Windows API and visual tools such as Microsoft’s Visual Studio. Five years ago I saw that The Web was the future of user interfaces so I took some time out and retrained myself as a web developer. JavaScript was pretty easy to learn but cross-browser incompatibilities meant that it was extremely difficult to build consistent interfaces. Things have improved a lot but there is still a lot to know and code around. Coding around browser differences is now a passion of mine. :-)

With JavaScript seeing somewhat of a revival from it’s DHTML origins, are there particular sites or books that you would recommend to people wanting to learn the ropes?

I learnt JavaScript by reading David Flanagan’s excellent JavaScript: The Definitive Guide. The rest I learned from googling for solutions to coding problems. Sites that I visited frequently included Scott Andrew LaPera’s (who now produces The Strange Zen Of JavaScript) and WebFX from Erik Arvidsson and Emil Eklund.

Probably one of the core elements of object oriented programming with JavaScript is declaring an object. Some create a function and use Others use the prototype property. And others use object literals. Is there a definitive way that we should be using or does it really matter?

To understand object construction in JavaScript you really need to understand prototype based inheritance.

Consider the following constructor:

function Circle(radius) {
    this.radius = radius;
    this.getCircumference = function() {
        return 2 * Math.PI * this.radius;

You create an instance of Circle using the new operator:

var circle = new Circle(50);

Because functions are first-class objects in JavaScript, every time you create a new Circle object you are also creating a new getCircumference method. It is also worth noting that you are creating a closure as the getCircumference method is defined inside another function (the Circle constructor).

An alternative way to express this class is as follows:

function Circle(radius) {
    this.radius = radius;
Circle.prototype.getCircumference = function() {
    return 2 * Math.PI * this.radius;

In this case the getCircumference method is defined on the prototype property of the Circle constructor. When the Circle class is instantiated a new getCircumference method is no longer created. Instead this method is inherited from the prototype. This is clearly faster and uses less memory than the previous technique. In most cases this is the technique I would recommend.

You often hear of closures but are they good or bad?

Closures have a bad reputation because of the memory leak problem in Internet Explorer. Fortunately, this bug only occurs under certain circumstances and in most cases closures are safe to use. To answer your question, closures are a powerful feature of JavaScript (good) just beware of the IE bug (bad).

Your ‘about’ page says that you mostly rely on alert for bug testing. Is this still the case?

Yes. :-) It is a quick and easy way to debug code. If I need to properly inspect data or step through code then I use the Microsoft Script Debugger. It’s not a great debugging tool but I’ve been using it a long time so I know how to use it effectively.

You’ve just started your JavaScript Tips. Can we expect this to be an ongoing series? Any other interesting projects that you’d like to share?

Yes. This will be an ongoing series. Let’s see how long I can keep it going. I might run out of tips quite quickly!

As for other projects, I will be concentrating on the Web Forms 2.0 implementation for Internet Explorer. This is written using my JavaScript OO framework so I will be working on that a lot too. I may also write an implementation of the canvas element. Oh yeah, I’ll be releasing the first production release of IE7 early in the year. :-)

Thanks for taking the time Dean to answer some questions.

Cheers Jonathan!

Published March 19, 2006 · Updated September 14, 2006
Categorized as Writing
Short URL:


7 Comments · RSS feed
Justin Palmer said on March 21, 2006

Great interview Jonathan. You didn't drill him on whether he was secretly using Prototype or not? ;-)

NocturnDragon said on April 30, 2006

Great interview! but it looks like Google has beaten Dean on an implementation of canvas for IE

Andy G. said on November 16, 2006

I´m also a Dean Edwards permanent reader.
You have chosen a really good interview partner Jonathan..

Dominik said on November 21, 2006

Wow what an interesting Interwiev. Great Job Jonathan. I read often your Blog. Greetings from Germany :)

Antje am Wochenende mit dem Kind said on April 02, 2007

the interview is now a a year ago - but still a lot to learn. Thanks

Markus said on June 19, 2007

Nice Interview but i think it's time for an update ;-)

Michel said on September 22, 2008

Interwiev very interesting. We come from Germany and are very often on their blog. You have a really good partner.

Sorry, comments are closed for this post. If you have any further questions or comments, feel free to send them to me directly.

Want to learn about scaling CSS for large projects?

I'm available for full and half-day workshops on scalable CSS architecture. I can provide on-site training for your team. Interested?
Get in touch.