Feeds

Google's JavaScript assassin: Web languages are harder than VMs

Dart daddy Lars Bak: JavaScript? I have no problem with it

Boost IT visibility and business value

The problem with programming languages is that everybody’s got an opinion - just ask Lars Bak, the Virtual Machine guru who is building Google’s planned (by Google at least) replacement for JavaScript.

Bak has spent 15 years working on object-oriented VMs (virtual machines) at Google and Sun Microsystems and notched up 50 patents in the process. He’s responsible for HotSpot, a core component of the Java stack and Java's default VM now owned by Oracle. Also, he developed Google’s V8 JavaScript engine - which was so fast Google had to bring in a new raft of benchmark tests to deliver credible test results for JavaScript in its browser. V8 helped begin a browser JavaScript performance war, one consequence of which was that Microsoft was forced to change how it built Internet Explorer so that it did not have to risk getting left behind by web developers.

The Danish programmer joined Google in 2004 and began work on V8 in 2006 with Google software engineer Kasper Lund, but it was in 2010 that he started Dart – a class-based language inspired by SmallTalk, Java and C++ and supposed to be faster than JavaScript. Google’s objective is that Dart will eventually replace JavaScript as the "lingua franca" of web development.

That's a big objective. JavaScript began as the last dying gasp of Marc Andreessen's defeated browser outfit NetScape at the end of the 1990s. The Netscape language became an Ecma International standard in 1997. Sixteen years later, JavaScript is number 10 in the world ranking of programming languages and has inspired a head-aching number of libraries and development frameworks from those who know and love it.

Fresh off his success on VMs, the idea for Dart was a simple idea - to improve the state of the art of client-side web development. “We just want to improve the web platform... so that it’s easier to write bigger apps,” Bak tells The Reg during a recent interview as Dart marked its M1 delivery.

He's grown up a lot since then.

“I have learned it’s much harder to do a language than a virtual machine,” Bak confesses. “People are extremely opinionated when doing a language,” he says, before the Dane adds: “But this is great – I see that people care. I have learned that you have to do it properly.”

The problem is the curly-bracket heads just don’t accept your work as happily as most of them would accept any VM that's handed to them.

“The initial reaction to doing another programming language is people say: 'We have one that’s sufficient'. Change can be hard for some people. The other reaction is when you design the programming language [Dart] you [try] to make it simple so people can use it in an hour, so the other category of comments is: 'It’s a bit simple for me'."

“Some from the academic world expect more complex constructs but my view is if you don’t make it easy for ordinary programmers you don’t have a chance of success. That’s why the land has curly brace syntax and single inheritance.”

'I have learned it’s much harder to do a language than a virtual machine... People are extremely opinionated when doing a language' - Lars Bak

That’s meant a lot of heavy lifting so Bak hired an engineer to work on Dart’s semantics. When we spoke there had been 12,000 revisions with a new version every six to eight weeks. Since we chatted there's been an M2 release with more revisions. Dart 1.0 is now due this summer, Bak tells us, when the language should be finished and delivered along with a “good” set of libraries and a “good community of people using Dart.”

The unfinished part, ironically, is the Dart VM and that’s vital because without it, Dart can’t complete Google’s mission to infiltrate the world’s browsers. Without the VM, the Dart source-code file will generate JavaScript code. The VM is also essential to some of the high-speed start-up stuff that Google’s Dart team has planned. The Dart VM is currently only in Chromium, the open-source basis of Google’s browser.

Building a language might be hard but what is arguably the most demanding part still lies ahead: adoption. Google and Dart must convince web devs, browser-makers and major websites like Facebook and Digg to surrender their love of JavaScript for a brand new language from Google - a partisan player on the web with whom many are competing.

Before Dart even gets to this stage, though, it must convince the Googleplex that it is the future and that JavaScript is the past. Google is heavily invested in JavaScript with Gmail, Google Analytics and its homepage on JavaScript.

Google itself is the first domino that Bak needs to tumble - and it's a heavy one. “If we do not to prove ourselves the obvious benefit of using dart then Google will not convince other browser makers. My plan is to demonstrate better performance,” Bak admits.

No Googley magic wand

Just because Dart is Google's baby, that doesn't mean Dart is a shoo-in.

“Google is a big company and people are deciding what tools are most effective. I have to walk around and make sure people can see the advantage in using Dart,” Bak says. “So far so good, but no - there’s no magic wand inside the Googleplex. I don’t expect that everything to flip over next summer and that’s fine. It takes time to get a language popular inside and outside the company.”

Dart is pitched as the language needed to build the kind of complex web properties owned by Google that the Dart team claim tax JavaScript.

Dart consists of the language under a BSD licence, libraries and editor. Like JavaScript, Dart uses C-like syntax and keywords. JavaScript, though, is a prototype-based language whereas objects in Dart are defined using classes and interfaces – just like in C++ and Java. You can also declare variables using static types. By borrowing from C++ and Java, the idea is Dart is familiar yet even easier and quicker to code in, and should generate fewer bugs – called side effects.

Bak claims Dart’s object model is simpler and more structured than the object model in JavaScript. The payoff is that applications start faster and are more efficient, doing a smaller number of computes and not straining garbage collection. You can also allocate an object to a known field and you can group objects, cutting down on any unwanted events that divert processing power.

Build a business case: developing custom apps

More from The Register

next story
KDE releases ice-cream coloured Plasma 5 just in time for summer
Melty but refreshing - popular rival to Mint's Cinnamon's still a work in progress
Leaked Windows Phone 8.1 Update specs tease details of Nokia's next mobes
New screen sizes, dual SIMs, voice over LTE, and more
Mozilla keeps its Beard, hopes anti-gay marriage troubles are now over
Plenty on new CEO's todo list – starting with Firefox's slipping grasp
Apple: We'll unleash OS X Yosemite beta on the MASSES on 24 July
Starting today, regular fanbois will be guinea pigs, it tells Reg
Another day, another Firefox: Version 31 is upon us ALREADY
Web devs, Mozilla really wants you to like this one
Secure microkernel that uses maths to be 'bug free' goes open source
Hacker-repelling, drone-protecting code will soon be yours to tweak as you see fit
Cloudy CoreOS Linux distro declares itself production-ready
Lightweight, container-happy Linux gets first Stable release
prev story

Whitepapers

Implementing global e-invoicing with guaranteed legal certainty
Explaining the role local tax compliance plays in successful supply chain management and e-business and how leading global brands are addressing this.
Boost IT visibility and business value
How building a great service catalog relieves pressure points and demonstrates the value of IT service management.
Why and how to choose the right cloud vendor
The benefits of cloud-based storage in your processes. Eliminate onsite, disk-based backup and archiving in favor of cloud-based data protection.
The Essential Guide to IT Transformation
ServiceNow discusses three IT transformations that can help CIO's automate IT services to transform IT and the enterprise.
Maximize storage efficiency across the enterprise
The HP StoreOnce backup solution offers highly flexible, centrally managed, and highly efficient data protection for any enterprise.