Skip navigation

Web Standards

warning: Creating default object from empty value in /var/www/vhosts/ on line 33.

It’s not everyday that someone tries to add a new programming language to the web. There’s a good reason for that. The great trinity of web development — HTML, CSS and JavaScript — while not perfect has proved itself highly flexible and capable of adapting as it evolves, which, in the end, might be more important than perfection.

But, regardless of how well those three have served the web thus far, they are not enough for Google, which is hoping the web will now embrace Dart, Google’s brand new programming language for “structured web programming.”

The first hint of Dart surfaced about a month ago when an internal Google memo was leaked onto the web (the memo itself dates from 2010). In it Google claims that “JavaScript has fundamental flaws that cannot be fixed merely by evolving the language.” The answer, for Google, was to go off and create its own homebrewed solution.

That solution is Dart, a “class-based optionally typed programming language for building web applications.”

Lars Bak, a software engineer working on Dart, says the language is designed to work with every thing from “a one-person project without much structure to a large-scale project needing formal types in the code to state programmer intent.”

In other words, Dart is aiming to be a one-size-fits-all solution for writing apps on the web. Dart has been built from the ground up with this goal in mind. Indeed Dart offers some interesting tools, including optional types and the ability to declare private methods via an underscore. Unfortunately for Dart, a couple of novelties don’t seem to be winning over programmers. The Hacker News discussion thread on Dart is full of rather barbed critiques with hardly a supportive voice to be heard.

Dart on the web

Appealing to programmers is only half of what Dart needs to succeed, it also has to work well on the open web. For that Google has two solutions.

The first and ideal solution will be to execute Dart code in a browser-native virtual machine (very similar to how JavaScript is handled today). Of course that means the rest of the browser makers need to join Google in supporting Dart. Because that isn’t likely to happen any time soon, nor will it ever happen for legacy web browsers, Google has a fallback plan — a compiler that translates Dart code to JavaScript.

While the JavaScript compiler solution will mean slower web apps, it also means that Dart apps would always be able to run, regardless of the browser in question. That’s good for older browsers, but it also raises some questions about where Google plans to go with Dart.

Essentially Google has set up a two-tier system for running Dart in the browser, and that is where Dart might run afoul of the open web.

Prior Dart Art

The leaked Google memo that appeared on the web last month created a tempest in the web standards community teacup. The idea that Google had a secret project designed “to replace JavaScript as the lingua franca of web development” did not sit well with those who support open web standards.

The company appears to have backed off that stance somewhat for the official release. In fact Google hardly mentions JavaScript in its Dart announcement and Lars Bak tells CNet that Dart is “not going to replace JavaScript… JavaScript is a cornerstone of the Web today, and it will continue to be for a long, long time.”

That message may be too little, too late. Publicly Google may now be pushing the message that Dart is complimentary to JavaScript, but the blunter language and goals outlined in the leaked memo are already out there, fresh in developers’ minds. That, combined with Google’s less than stellar track record with its “open” projects may make it difficult for Dart to find supporters.

While Dart is open source and available for anyone to use, Google does not have a strong record of fostering open projects, that is, projects where the community can not just download and compile code (Andy Rubin’s “definition of open“) but can actually have a hand in creating features and guiding the direction of the project.

Until the latter component is well established don’t expect other browser makers to adopt Dart. So long as Google controls the strings it’s unlikely its arch rivals like Microsoft and Apple will support Dart.

Without that support Dart won’t be running in a virtual machine; instead it will fall back to running as JavaScript. That effectively means that, while Dart will run in any browser, it will likely have subpar performance in any browser lacking the virtual machine.

What standards proponents fear is a web where only Google’s Chrome browser ever fully supports Dart. That would mean that, while Dart apps would work everywhere, they’d be significantly faster in Chrome. That would send the web back to the bad old days of “works best in Internet Explorer” websites, only this time around it would be “works best in Google Chrome.”

Future Dart

It’s possible that Google will use Dart to finally create a true community-driven project. The company has already said it plans to eventually submit Dart for standardization, which would certainly help.

It’s too early to write off Dart, but it’s also too early to say it will be anything more than a novelty Google uses in its own apps (like WebP or even SPDY). Even if Dart can convince both developers and browser makers to jump on board, don’t look for Dart to become the “lingua franca of web development” any time soon.

See Also:

Your rating: None

We’ve showed you where on the web you can find practical examples of HTML5 — like Google’s homepage, Scribd’s document viewer and Vimeo’s new video player. However, to really see the bleeding edge of HTML5 and what might be possible in the future, you’ll have to look beyond the practical.

Big names have released HTML5 showcase sites, Apple and Google among them. More importantly, hundreds of curious designers around the web are constantly experimenting with HTML5, trying to push the boundaries and see what’s possible with the new markup language and its related technologies. Many such experiments have little practical value as of yet, while others may well find their way into your favorite online games and web apps in the next few years.

Of course, some of the examples below aren’t purely HTML5. In fact there’s been quite a bit of talk about what is and what is not HTML5. All of the examples below use HTML5 tags, however some also use elements of CSS 3 and almost all of them use JavaScript to handle animation and user interaction.

In fact, most of the more interesting experiments we’ve seen revolve around the HTML5 canvas tag and JavaScript. The HTML5 canvas tag is essentially what it sounds like, a canvas on which all sort of JavaScript-powered goodness can be displayed. Regardless of whether you think of the end product as being an experiment in HTML5 or JavaScript or both, the results are impressive.

One other thing to keep in mind: HTML5 is still an unfinished spec and browser support varies. All of these experiments work in the latest versions of Firefox, Chrome, Safari and Opera, but other versions of those browsers and Internet Explorer won’t be able to see these demos.

If you’d like to see some more innovative examples of what’s possible when JavaScript and HTML5 collide, check out Swedish developer Hakim El Hattab’s HTML5 experiments. Ranging from arcade-style games like Sinuous to Twitter messages in animated bubbles, Hattab’s experiments are creative and fun, if not immediately useful to most people. Just view source to see what makes these examples tick.

Hattab includes a note on his site saying, “please don’t use this as HTML5 vs Flash firewood,” which is worth mentioning since, yes, you could do many of these experiments in Flash, but that isn’t the point. The point is to do it using open web tools that will work everywhere — modern web browsers, iPhones, Android Phones, iPads, next year’s toaster and any other device with a standards compliant web browser.

That said, some potentially useful animation experiments are in fact ports of Flash animation libraries. In these cases the innovation is less about originality than practicality — taking what’s good from Flash and porting it to JavaScript where it can be used with HTML5.

For example, Jonas Wagner has ported a Flash 2D physics engine JavaScript. The result is a JavaScript physic engine you can incorporate into your own animation projects.

Another cool experiment in physics engines comes from developer Florian Boesch’s website, Codeflow, which features an experiment using Canvas and JavaScript to animate dots. In Boesch’s experiment there are 15 dots on the screen, and each has a velocity and pulls on each other dot, thus changing their velocities. As an added bonus Boesch breaks down all the code behind the scenes and shows you how everything works.

Physics engines are useful for building web-based games, but how about some cool retro graphics? Yes, HTML5 can do that too.

Developer Joseph Huckaby has created a way to generate that old school video game look using a full 8-bit color cycling engine, rendered into a canvas tag in real-time. Huckaby used Mark Ferrari’s famous game illustrations to create some awesome classic video game scenes. You can learn more about how Huckaby created the 8-bit rendering engine on the Effect Games website.

Not into retro games? How about a multi-user collaborative sketchpad? Like many of the examples here, the heavy lifting in this one is done by JavaScript, with an HTML5 canvas tag providing the canvas and some websockets for the multi-user aspect. Unfortunately this one will only work in Chrome.

The sketchpad was created by Ricardo Cabello, of Mr. Doob, which has dozens of other HTML5 experiments as well as plenty of Flash-based experiments.

This is just a small sampling of the many HTML5 experiments on the web. If you know of other cool sites, showcases or other experiments be sure to chime in the comments.

See Also:

Your rating: None