By Craig Buckler

Are You Targeting Google Dart?

By Craig Buckler

Dart has reached its version 1.0 target. Google may not care for version numbers but this illustrates to the world that Dart is ready. Whether we are is a different matter.

Dart is (yet another) Google development language for the web. It works server-side as an alternative to PHP, .NET, Ruby, etc. Controversially, it has also been designed as a replacement for client-side JavaScript. Developers can target browsers which implement the Dart VM or pre-process code to native JavaScript.

I was particularly scathing about Dart when it was announced in 2011. My main issues:

  1. Why create another language when plenty of more familiar options are already available?
  2. Why produce a closed platform which is certain to be rejected by the W3C and other browser vendors?
  3. Why does “Hello World” in Dart compile to 17,259 lines of JavaScript code?

Version 1.0 will still generate more than 400Kb but, according to the benchmarks, dart2js code is often faster than native JavaScript. Hmm. I’m not convinced well-written JavaScript code could be outpaced by compiled Dart but the team is addressing the points. If you’re running Dart in its own VM, you can expect performance gains of up to 130%.

The updated site now offers a range of free tools including an Eclipse-based IDE, plug-ins for other editors, the dart2js compiler, the Dartium browser, a full SDK, package manager and API documentation.

What’s not to like?

I’ll tell you: Dart will join the long list of scrapped Google projects. They’ve been patient but, if Dart was to succeed, it would have already done so. Let’s add some more points to the list of criticisms:

Dart is not supported in Chrome
You can’t use Dart in Google’s own browser. Dartium is Chromium with the Dart VM — so there shouldn’t be any technical issues preventing its addition to Chrome and perhaps other Blink-based browsers such as Opera. So why isn’t it there?

No other vendor wants Dart
Dart has been openly denounced by Microsoft, Apple and Mozilla. Google could create VM plug-ins for those browsers but, assuming vendors didn’t actively block it, widespread distribution would be difficult.

dart2js browser support is limited
The JavaScript compiler creates code for the latest versions of Chrome and Firefox, Safari 6+, IE9 and IE10. There’s no guarantee your code will work in IE8, IE11 or mobile browsers.

Difficult client-side debugging
Debugging dart2js applications in a browser requires source maps to trace errors back to the original Dart code. You can do that in Chrome, but you’ll have trouble in most other browsers — especially on mobile.

Developer uncertainty
Perhaps you use Dart. Perhaps you love the language. Does it worry you that Google has abandoned projects which were far more commercially successful?

Google backs JavaScript
The Dart FAQ claims: “Google wants web development to be great, and if that happens with JavaScript, we’re happy.” However, Google is continually improving and promoting their V8 engine used in Chrome and the Node.js runtime. If JavaScript is flawed, they have the power and influence to fix it — why is it necessary to start again?

At best, they’re giving mixed messages. At worst, they don’t believe Dart has a strong future for client-side development.

JavaScript is cooler than ever
Two years is a long time on the web. JavaScript is in a stronger, more dominant position than it was when Dart first appeared.

Why Dart was Devised

OK, I get it. Java and JavaScript are two languages separated by a superficially similar syntax. JavaScript is initially confusing for anyone with a background in C-like programming. You’ll be tempted to use classical inheritance techniques, fail dismally, and find numerous other reasons to berate the language. JavaScript is different; it feels wrong and you’ll want to return to the cozy world of server-side or desktop development. The Dart team has toned down their anti-JavaScript sentiment but that’s exactly why the project was started.

JavaScript is not perfect and there are several issues which make compiler optimization difficult. But it’s not fundamentally flawed. If anything, the language becomes better the more you understand and use it — you may even reach the conclusion that classical inheritance is too rigid and clunky.

I have nothing against innovation and Dart may become a successful server-side development language. Unfortunately, Dart isn’t particularly innovative and, in the browser, it’s a solution looking for a problem.

Do you think Dart can succeed?

  • Anonymous

    Node.js and HTML5 API makes JS cooler(for me), but the language itself is still the same. Maybe ES6 will make JS a decent language, but when will it land in the browsers? Dart now has all the good parts that is missing from JS.

    • Anonymous

      Fair enough, although what’s JavaScript missing?

      For many developers, it’s classes. They’re coming to ES6 but, in some ways, I think that’s a shame. I love prototypal inheritance but, admittedly, it took several years before I understood what I was doing (presuming I understand it now!)

      • Taylor Ren

        It is not missing but too much. Frankly speaking, when I did my web frontend, I never used closure, anonymous functions, etc. It could be just out of my personal coding flavor (and not a good programmer, after all).

        What I am really looking at is “stripping” off. And thus I like Dart.

        I found Dart easier because all the things you mentioned. One thing is not working for me here is that it is not running well in FireFox after compilation into JS.

  • Taylor Ren

    I have been developing my web site with PHP for quite sometime (with Symfony). One of the worst things that I have all the while is there is no interactivity can be created painlessly.

    JavaScript (jQuery) has come into my radar but I really don’t like the way it programs. I mean, not really structured, in my view.

    I need a structured, OO web development tools. Thus Dart is in my radar. I had created a simple web app with Dart, and also the corresponding backend in PHP in 3 days. Before using Dart, the frontend stuff would just kill me.

    Just my penny-worth view on this.

    • Anonymous

      JavaScript is as structured as you want it to be. The same can be said for any language – especially PHP.

      I’m surprised you found Dart easier. After all, it’s doing the same job and you still needed to compile it to JavaScript. Was the syntax more familiar? Were the tools better? Was the documentation more thorough? Were cross-browser issues easier to handle?

    • ZeroFactorial

      Same experience here. I am not a expert programmer, but do try and try again to be a good developer. I have a couple HTML5 apps in a webview in the android appstore. I could not write these in JS due to the pain of the langauge and how difficult it is to use for a guy like me. THus, I wrote them in GWT.

      Now that dart is here, i am re-writing my apps and it is a snap. Dart is so less bloated feeling then GWT and is not a work in confusion like JS. It just makes sense and is a snap to get started in.

  • kpolo

    Javascript’s flexibility is also its downfall. Unless you can refactor code (which you cannot) and easily understand code (which you cannot in javascript because of lack of type enforcement – so you have a huge cognitive burden of remembering what parameters to send to a function – angular is choke full of such cases) writing large systems in javascript is a risky undertaking. I’ve built extremely large interactive systems using GWT – millions of lines of code. To coordinate that kind of complexity with javascript would be suicide.

    Your article and comments come across as the rants of an angry man!

    • Anonymous

      I’m sorry you think my tone is angry. It’s certainly not as bad as what you’ll hear from Dart developers if Google abandon the project!

      Types are coming to ES6 which may address some of your concerns. People are already writing large systems in JavaScript so I don’t necessarily agree it’s risky. However, finding JavaScript developers who truly understand the language is another matter.

  • Anonymous

    From the same stable, AngularJS gives JavaScript structure and still lets us use JaveScript.

    • Anonymous
      • Anonymous

        Thanks Bruno, I read the discussion with interest and there is nothing that would convince me that Dart will be a viable option anytime soon. On a more practical note, I am hearing a lot of commercial interest in AngularJS skills from the job market.

        • Anonymous

          The market is flexible. Since that discussion I’ve had a big Dart commercial project, and a big Angular commercial project. Then again, these days I’m more about selling the tech I’m interested in to the client, rather than accepting their requirements.

          • Anonymous

            Thanks Bruno, I am glad to hear that you are having some commercial success with Dart, the picture looks less rosy in the UK.

            I also like working with tech I am interested in and for the first time since the web started, there looks like there could be one language that you can use anywhere, front and back end, on any device, a language that is visible and accessible to learn from, easy enough for beginners to pick up and robust enough for heavier duty applications.

            A language with a massive and vibrant community, constantly turning out new innovations, tools and libraries, a language not owned by a commercial entity. I don’t know what is wrong with all that, it is not always perfect, it can be tricky if you are used to working with other languages but a small price to pay considering the benefits. I don’t think it is broken and as it is the most widely supported, commonly used language on the planet, I would say a lot of other people share my view.

          • Anonymous

            Good adoption is definitely beneficial, though I’m not 100% sure not being owned by a commercial entity is a good thing. Everyone has their own version of JS right now, and the versions are getting more different by the day. Look at the “let” keyword in JS – it’s been in FF for years, yet you need to flip an experimental flag in Chrome to get access to it, it’s absurd. Without guidance, it’s a huge pile of hacks and problems that everyone has a different solution to. Far be it from the truth you can’t earn money with it or make big and/or good projects – on the contrary, JS is quite the moneymaker. But it has no structure, and no guidance, and that’s something I really like. In the end, it’s all personal preference.

          • Anonymous

            Well said, Mike.

            I agree not everything is perfect in the JavaScript world, but no language is. The only reason Dart is stable is because it’s young and has a single vendor. The same could have been said for JavaScript in 1995. I’d be amazed if Dart has the same longevity.

  • Sebastian

    The only thing I like about Dart is the optional static typing, I think this is hugely useful. I wish JS will adopt something like that in the future if possible. Apart from that I don’t see the benefit, I got to the conclusion long time ago that classical inheritance is not needed at all. I even find prototype inheritance a cleaner paradigm, so I am happy with JS as it is in the respect. So I am more likely to adopt TypeScript in the future than Dart.

  • Stephen Collard

    We are developing a lot of websites for clinical applications Javascript does the job admirably, it is easy to understand and as Craig said has developed a lot over the last two years . We really like Google but Dart is dead in the water.

  • Taylor Ren

    Well, Google is notoriously famous in abandoning its products. However, it will not necessarily mean Dart will be next. User base and products derived from Dart will determine the fate.

    BTW, noticed my earlier comments posted to this article is missing now. What happened?

    • Anonymous

      That is true but, in its current form, Dart can only ever be a small subset of JavaScript development. I would be hesitant about adopting it for a large project.

      Your comments are still there – click the “more replies” link.

      • mark_horsell

        where is the more replies link?

  • Anonymous

    Web is all about speed. You can lose a lot of clients, because of slow pages or apps.

    If Google Apps make a switch from Javascript to Dart and Chrome implements the Dart VM. They get a big speed gain by this and the Apps still could be used by other browsers(dart2js), but a little slower.

    Other vendors can implement it anytime they want. Dart is open source.

    Dart is fast:

  • Anonymous

    I don’t agree that the “web is all about speed”. It’s more about connectivity and platform-agnostic interoperability. Speed is important, but it’s not as though Dart is radically faster than JavaScript. You say yourself that dart2js is only a little slower – that is pure JavaScript code.

    You also have a lot of ‘ifs’. Will Google Apps make a switch to Dart? Even if the Dart VM is in Chrome, they would loose a good 50% of their market. Other than a marginal speed increase, what’s the commercial benefit in rewriting numerous systems from scratch?

    Dart is a proprietary technology and not a web standard. If you have no issue with that, you should look at comparable historical innovations introduced by Microsoft, Adobe and others.

  • Petar

    Why so many people speak of dart as a proprietary language. Yes, Google started it and supports it but It’s open sourced – BSD licensed. Yes, Dart may fail, but if this happens it would be only of political reasons. Why are everyone so afraid of Dart adoption, what are the alternatives – javascript, typescript, asm… really? I’m javascript developer (mainly) and I see the boost Dart would give me, in fact I’m rewriting some of my code mostly server side now. Dropping Dart is a nonsense for me.

    • Anonymous

      Dart is not overseen by an independent standards body. In addition, even though it’s open source, Google has full control – you can’t make changes without their say-so. You could fork it, but how would that help? It would simply fragment it further.

      Typescript and ASM.js are not the same. Typescript is a superset of JavaScript which compiles to native code. ASM.js is an optimized subset of the language. They’re both JavaScript whereas Dart is designed to be a complete replacement.

      Use Dart by all means. You’ll be fairly safe with server-side code, but will it ever be a success client-side unless Google achieve a browser monopoly?

      • Anonymous

        Javascript overseen by Ecma International which is an international, private (membership-based) non-profit standards organization for information and communication systems. So you can’t really change anything if you are not a member.

        And the worst is that they are so slowwwwwww. Latest Ecmascript release was in 2011. 2 long years ago and still nothing. No release date at all.

        For the record, Dart wants to be an open standard:

        • Anonymous

          Yes, JavaScript evolution is slow. But that’s not surprising given there are multiple interested parties — and it’s not as though we’re waiting for features which make it usable.

          Yes, Google has said they will make Dart an open standard. So why haven’t they? C# managed it.

          • Anonymous

            From the Dart FAQ: Once Dart reaches a certain level of maturity and acceptance, we expect that a standards process will be the next step.

            In the strategy section there is a lot of information about it.

          • Anonymous

            When will that be? No vendor other than Google has accepted Dart. Besides, why not do it from the start? As it currently stands, Dart is a dead-end for client-side development. VBScript has a wider installation base and look how that fared.

          • Anonymous

            This is why:

            Dart is not dead-end, because you can compile to Javascript.

            With asm.js, the vendors say that if you want fast client side code just compile to Javascript and do not touch it.
            Instead of improving JS we just make it the assembly of the web. Javascript seems like a dead-end for me.

          • Anonymous

            Except that compiling currently doesn’t work very well on all browsers. You’re certainly missing oldIEs and there have been reports of Firefox issues. And let’s not forget the half MB code overhead. The difference with ASM (and Typescript) is that they’re JavaScript to start with.

            If you dislike JavaScript, that’s fair enough. But you won’t get far in web development without it — irrespective of how well Dart does.

          • Anonymous

            I don’t dislike JS, i just hate the fact that, it still has a lot of silly problems, because Ecma works really slow. It makes HTML5 less cool.

            I just hate the fact that the only client side language is Javascript and i can’t choose. A lot of altJS is just subset of JS, so the speed is the same or worse and i need to learn a new language to get the same result.

            On the server side there is a lot of options.

          • Anonymous

            All languages have problems. Dart does, it’s just that few people are using it so there’s less exposure. Nothing will ever be perfect. If/when Dart ever becomes a standard, it’s evolution will be slower too.

            The problem for any JavaScript competitor is that JavaScript has a 15-year head start and it’s a great language (or certainly the problems aren’t bad enough). Dart doesn’t do anything new or revolutionary – it’s just different.

          • Anonymous

            Dart goal is to be a language for modern web development and that is a new thing.
            It has built in all the tools for modern web development(HTML5 API,DOM,pub,polymer,async,test).

            Did you even play with Dart? Because in your Typescript article you showed Typescript’s features, but in Dart case you just complain about it. All you do in every article is complain about how bad is Dart, but i think you never used it.
            You should get over your Dart hate, if you want to write impartially.

      • Kevin
  • Anis

    For a new language to be added to browsers there should be agreement between different companies and bodies and it didn’t happen. World still needs a simple language to script HTML pages across different browsers, and we need that language to be a little more flexible so we can use it for newly added features and gadgets like canvas, websockets, webrtc, webgl and Javascript still serves all these needs. Now if you want a server side language that is used for serious business programming there are Java, C++, VB.Net/C# languages that already rule. Dart was created for one and only one purpose to replace Javascript and it failed at that not because Dart is not better but because Javascript is not bad at serving its own little purposes that are so crucial for everyone and it is already omnipresent so even if we hate its bad parts we will learn to avoid them as long as it gives us power to create amazing stuff in internet domain.

  • Petar

    It would be a developer’s lost not Google’s if Dart didn’t make it. Of course that no other vendor will accept Dart as for now. Not even Google chrome supports Dart VM. But any new technology needs time. If people start using it (and I’m sure once they try it they will) other vendors are going to reconsider their decision.

    • Anonymous

      Question: how will people start using Dart if no one supports it? Chicken and egg.

      • Petar

        Unfortunately Dart is stuck with dart2js for now. But this is just for the client side. There is far less debate over the server side maybe because the team’s focus is primarily on the client side. As I said the server part of the application I develop is now all Dart. Previously I used node.js (which has gained a lot of traction), but I can tell you (with respect to node.js guys) that Dart server apps are way better in performance and design. Dart is not just a “trying to replace javascript” language, Dart is a platform for both client and server and adding that it’s the fastest dynamically typed language to date is more than enough to get some traction.

        • Craig Buckler

          Yep – I have no issue with Dart server-side. I suspect that’ll become it’s main purpose since it’s unlikely to win a battle with JavaScript on the client.

    • Andrew Rhyne

      I disagree. JavaScript is a beautiful and powerful language for those of us who have taken the time to learn it’s strengths and weaknesses, even developers coming from C/C++ (myself included!). Dart seems to show promise, and I do enjoy the syntax, but I don’t like/dislike it any more than pure JavaScript. Other languages like CoffeeScript and TypeScript, I absolutely abhor.

Get the latest in Front-end, once a week, for free.