Why Google Dart Will Miss Its Target

Share this article

Dart
is Google’s new programming language designed for creating structured web applications. You’ll be able to run it on the server but it’ll also run on the client. In a browser. Depending on what you read, Google has both admitted and denied that Dart is a replacement for JavaScript. However, Chrome will shortly be able to use either language and, given the choice, I’m sure Google would prefer developers used a solution they control. I was initially skeptical about Dart but reserved judgment until more information was available. I can now categorically state that it’s almost certain to fail in the same way VBScript did in Internet Explorer.

Dart’s Goals

Dart is an open source project with the following design goals: 1. Create a structured yet flexible programming language for the web. Great. But what’s wrong with all the other structured and flexible languages? One of the web’s greatest benefits is you can use any server-side language you like: PHP, C#, VB, Perl, Java, Ruby, Python, etc. There’s always room for improvement but we’re spoiled for choice. Dart doesn’t offer something different — just an alternative. 2. Make Dart feel familiar and natural to programmers and thus easy to learn Syntactically, Dart is very similar to Java, C++ and C#. So why didn’t Google simply adopt one of those languages? That would have made it even easier to learn. 3. Make Dart appropriate for the full range of devices. Google has stated that they’re “up against fragmented mobile platforms”
. Wouldn’t another language fragment it further? It’s possible Google will create a native Dart runtime for Android. Perhaps they’ll even create a version for Windows phones. What about Apple — the most successful smartphone vendor? Not a chance. 4. Provide tools that make Dart run fast across all major modern browsers. Will Microsoft, Mozilla, Apple or Opera add native Dart clients to their browsers? It’s unlikely. Google could create plugins for those platforms but web developers won’t write Dart code until the plugin has a wide installation base. Unfortunately, users won’t install the plugin until compelling applications have been developed using Dart. Catch-22.

JavaScript Compilation

Google doesn’t actually need to a Dart plugin since they’ve created a compiler which translates Dart code to native JavaScript. Before you get too excited, take a look at a compiled Dart “Hello World” program. Nine lines of Dart code is successfully compiled to … 17,259 lines of JavaScript. I’m sure that situation will improve. Even today, it could be run through Google’s Closure Compiler to make the code more efficient. But the fact remains that native JavaScript written by a half-decent JavaScript developer will always beat compiled Dart code. Even if you do develop in Dart, you’ll probably want to drop into JavaScript at certain points to improve efficiency. But if you can already write good quality JavaScript, why would you develop in Dart? Catch-22-2.

Show JavaScript Some Love

It’s clear from Google’s documentation that Dart is aimed at developers who dislike JavaScript. Despite being the world’s most-used programming language, JavaScript is the most misunderstood. The name doesn’t help — it’s neither Java or script — but the biggest cause of bad press comes from professional programmers. Initially, JavaScript looks a little like C++ or Java. Developers with knowledge of those languages hunt through the manuals for the class syntax only to find it doesn’t exist. They conclude JavaScript is awful or attempt to force classical inheritance techniques into their code. I implore you to persevere. JavaScript is flexible and allows you to write code in a number of ways. Once you understand concepts such as prototypal inheritance, JavaScript will earn your respect. It may not be perfect but class-based languages soon begin to feel clunky. Don’t expect it to happen overnight. It took more than a decade for developers to rediscover the beauty of JavaScript. Fortunately, there are many fabulous resources on the web and JavaScript is recognized as a first-class language.

Because You Can’t Fight it

The major problem for Dart is that JavaScript is everywhere; from humble mobile phones, to Apple iPads, to modern desktop browsers. Microsoft is even making HTML5 and JavaScript key technologies for application development in Windows 8. Even if Chrome reached 50% market share, would you develop in a language which was supported everywhere or on just half of all devices? Perhaps it would have stood a chance if it was released a decade ago, JavaScript was utterly terrible or Dart was revolutionary. None are true. I’m glad Google continues to innovate but Dart feels like a backward step. You may dislike JavaScript, detest HTML and despise CSS — but, to be a web developer, you can’t avoid them.

Frequently Asked Questions (FAQs) about Google Dart

Why isn’t Dart as popular as other programming languages?

Dart, developed by Google, is a relatively new programming language compared to established languages like Java, Python, or JavaScript. It was designed to address some of the issues these languages have, but its late entry into the market means it has a smaller community and fewer libraries. However, Dart’s popularity is growing, especially with the rise of Flutter, Google’s UI toolkit for building natively compiled applications.

What are the advantages of using Dart?

Dart is a versatile language that can be used for both client and server-side development. It’s object-oriented and supports strong typing, which can help prevent bugs. Dart also has excellent performance, thanks to its ahead-of-time (AOT) compilation to machine code. Moreover, Dart’s syntax is easy to understand, especially for those familiar with JavaScript or Java.

Is Dart difficult to learn?

Dart is considered relatively easy to learn, especially for those with experience in JavaScript or Java. Its syntax is clear and concise, and it has a robust set of core libraries. Google also provides comprehensive documentation and resources to help beginners get started.

How is Dart used in Flutter?

Flutter, Google’s UI toolkit, uses Dart as its programming language. Dart allows Flutter to avoid the need for a separate declarative layout language like JSX or XML, or separate visual interface builders, because Dart’s declarative, programmatic layout is easy to read and visualize. This makes the development process more straightforward and efficient.

What is the future of Dart?

While Dart may not be as widely used as some other languages, its future looks promising. Its use in Flutter has increased its popularity, and Google continues to invest in its development. As more developers discover its benefits, it’s likely that Dart’s usage will continue to grow.

Is Dart suitable for web development?

Yes, Dart is suitable for web development. It has a robust set of core libraries for building web applications and supports both client and server-side development. Dart can be compiled to JavaScript, making it compatible with all major browsers.

How does Dart compare to JavaScript?

While Dart and JavaScript have similarities, there are also key differences. Dart supports both static and dynamic typing, while JavaScript is dynamically typed. Dart’s syntax is more similar to traditional programming languages like Java, making it easier for some developers to learn. However, JavaScript currently has a larger community and more libraries.

Can Dart be used for mobile app development?

Yes, Dart is used for mobile app development, particularly in conjunction with Flutter. Flutter uses Dart to create high-performance, visually appealing apps for both iOS and Android from a single codebase.

What resources are available for learning Dart?

Google provides comprehensive documentation and resources for learning Dart, including a language tour, library tour, and various codelabs. There are also numerous online tutorials and courses available from various platforms.

Is Dart open source?

Yes, Dart is an open-source language. This means that its source code is freely available and can be modified or distributed by anyone. This openness encourages community involvement and the development of a wide range of tools and libraries.

Craig BucklerCraig Buckler
View Author

Craig is a freelance UK web consultant who built his first page for IE2.0 in 1995. Since that time he's been advocating standards, accessibility, and best-practice HTML5 techniques. He's created enterprise specifications, websites and online applications for companies and organisations including the UK Parliament, the European Parliament, the Department of Energy & Climate Change, Microsoft, and more. He's written more than 1,000 articles for SitePoint and you can find him @craigbuckler.

dartGoogle Tutorials & Articlesjavascriptjavascript optimization
Share this article
Read Next
Get the freshest news and resources for developers, designers and digital creators in your inbox each week