At some point, when nobody was looking, JavaScript evolved from humble

beginnings to become an important and full-fledged development

language.

James Duncan (@jamesaduncan), the chief architect at Joyent, is one of

the people who’s now putting JavaScript in unexpected places. In his

case, it’s using JavaScript as a web server development language

through the Node.js platform.

In the following interview, Duncan shares his thoughts on

JavaScript’s growth and how we came to depend so heavily on the

language.

For a lot of us who have been in the industry for a while,

JavaScript has always seemed like a toy language. When did that

change?

James Duncan: The big change started when Google

launched Maps. All of a sudden, there was this highly-interactive,

highly-usable, fun-to-play with web interface. It just blew away

almost every other map provider’s offering, and it was all constructed

in JavaScript. Everyone sat up and took notice.

What’s happening now is that JavaScript is installed on

millions and millions of edges of our network. If you think of every

web-accessing device as an edge on the network, then JavaScript is in

all of them. Every web browser has it, every smartphone has it.

In the same way that C has become permanent at the systems level,

with JavaScript, what you’ve got is a situation where it’s on so many

edges of the network, it really can never be eliminated. For better or

worse, JavaScript be there in 15 years.

Save 50% – JavaScript Ebooks and Videos JavaScript is everywhere: servers, rich web client libraries, HTML5, databases, even JavaScript-based languages. If you’ve avoided JavaScript, this is the year to learn it. And if you don’t, you risk being left behind. Whatever your level, we have you covered: Introductory / Intermediate / Advanced One week only—offer expires 14 June. Use discount code HALFD in the shopping cart. Buy now and SAVE.

There is still a lingering perception that JavaScript isn’t a

first-class programming language, though. Some vendors that use it for

scripting in their products pitch it as an easier language to

use.

James Duncan: I’ve long called the JavaScript

programming community the “dark development team in the sky” because

JavaScript requires a skill set that no one admits to having, but

everyone actually has. I can use this same positioning to explain why

it’s important: You walk into an enterprise and say, “Why are you

doing all of this high-ceremony .NET/Objective C-style development?

It’s just not necessary.” Because you can just do it in JavaScript,

you already have the skills. That makes it an easier sell.

I don’t think JavaScript is any less capable than any other language,

per se. It’s just that what goes into that JavaScript stack is very

much defined by what it’s embedded into. Because it originates in the

browser, we think of it as being easy and unsophisticated, but if you

dive down, it absolutely is sophisticated, capable and powerful. It’s

just that our mindset — and certainly the corporate mindset

— has been that JavaScript is only used for making pop-ups in web

pages.

In terms of the browser, some of us remember the nightmares of cross-browser JavaScript compatibility issues. Are they still around? And is HTML5 going to be

the next iteration of the same problems?

James Duncan: You’re right, the browser

environment is a nightmare. That’s becoming less true just because of

the nature of libraries like JQuery

and Prototype. Those

libraries have improved circumstances so that, for the most part, if

someone’s writing code in JQuery and really sticking to JQuery,

they’re probably not going to have many problems anymore. Or if they

do run into issues, they’re either impossible to fix because something

is fundamentally broken or the fix is trivial. There doesn’t seem to

be much in between.

HTML5 is fascinating. If you look at things like WebSocket and the

Web Worker specs, they seem to be implemented pretty uniformly from

browser to browser. So I think it’s getting better. The browser

vendors have learned their lesson: Trying to fight the standard isn’t

sensible. Even Microsoft with IE has gotten much better with this

— they’ve got a long way to go, but they’re much better than

they were.

We’re currently seeing somewhat of an arms race regarding

JavaScript execution speed. Is there an end in sight?

James Duncan: The cool thing is that we’re just at

the tip of the iceberg. There’s no doubt we’re going to see huge

performance improvements, which we’ve already seen in part over the

last year. It’s going to plateau eventually, but I think there is still

room for it to get faster and faster. We’ve had decades of compiler

research going into making the fastest or most optimizing C compiler possible.

That sort of research spend has not happened for dynamic languages in

non-academic environments before, with the possible

exception of Smalltalk, but it’s happening now around JavaScript. So you’re

still going to see performance improvements.

A hot topic in computing is parallel programming in languages such

as Erlang. Is JavaScript going to

join the party?

James Duncan: Node, in some ways, has a similar

view: it’s all asynchronous-based programming, all asynchronous IOs.

Where it steps away from what Erlang is doing is that it explicitly

says, “You shall run as one process.” You get one CPU to play with.

What we’re going to see inside the Node space is some capability to

have messaging between CPU cores and, therefore, Node processes

running on different CPU cores. I don’t know if anyone’s going to go

to the same extreme as Erlang, but some of the things Node is doing are

similar.

What would you like to see changed in JavaScript?

James Duncan: For me, the two points are: One,

don’t break the web, and two, it would be great to see some sort of

concrete class system. That’s not to say I dislike the prototype-based

object orientation within JavaScript, but I think a lot of people get

confused by its capabilities. Rather than understanding it as sort of

a liberating thing, they see it as a limiting thing. Putting some

syntactic sugar around classes would go a long way toward easing

people into the language from other sources.

This interview was edited and condensed.

Associated photo on home and category pages: Node Globe Pics by Dan Zen, on Flickr

Learn about Node.js this July at the O’Reilly Open Source Convention in Portland, Oregon. For a comprehensive orientation to Node, attend Monday’s Node tutorials and then join us all day Tuesday at Node Day for total immersion in the people and technologies making up the Node ecosystem. Save 20% on registration with the code OS11RAD

Related: