It’s been almost six years since Dart, a general-purpose programming language developed within Google, made its debut. Since then, it’s slowly risen in the rankings: the August edition of the TIOBE Index, which measures the popularity of programming languages, put Dart in 20th place, up from 26th a year ago. Meanwhile,
analyst firm Redmonk pegged it midway up their June language-popularity chart. Although it seems unlikely that Dart will topple “big” languages such as JavaScript or
Python anytime soon, its slow-but-steady rise suggests it’s a language to keep an eye on—and some recent developments may even allow it to climb higher. Dart was originally pushed into the world as the answer to JavaScript’s failings. Although Google relies extensively on JavaScript for Google Maps, Gmail, and other core products, maintaining large code bases in the language is difficult. Object-oriented code in JavaScript is different because it’s not class-based, instead relying on prototypes to create objects; in addition, there are
other quirks that drive even experienced developers absolutely nuts. Had Google released Dart five years earlier, it might have succeeded in eclipsing JavaScript. But browser-makers avoided it; that lack of adoption led to Google announcing in 2015 that Dart VM
would not be imported into Chrome. Although Dart failed as a direct JavaScript rival, Google managed to pivot the language into something new. The company’s internal teams (most notably the developers working on AdWords and AdSense) adopted it as one of their main languages, reportedly impressed by its speed. To the public and third-party developers, Google pushed Dart as a compile-to-JavaScript language, similar to
CoffeeScript.
AngularDart
For those interested in using Dart to build web apps, there’s also AngularDart, which Google’s internal teams have used to build vital platforms. If you’re familiar with AngularJS, the open-source web-application framework for JavaScript, then you already get what AngularDart can do—it’s literally the same thing, just for Dart. AngularDart has a reputation as a framework that produces streamlined and blazing-fast code. Late last year,
HackerNoon produced a pretty good list of the reasons to consider using it, including scalability and extensive documentation.
Via GitHub, you can also check out the AngularDart components that Google uses to build apps that align with its
Material Design philosophy—especially useful if you’re building Android apps, or a product that leverages Google services in some way.
Benefits
I like Dart. It has some modern features familiar to anyone who’s worked with the latest generation of languages (i.e., Swift, Kotlin, etc.), including static typing, generics, async/await, functional programming features, streams and SIMD. Add to that Isolates and zones, two higher-level constructs for concurrency and parallelism, and Dart is a nicely designed language. Another feature well worth mentioning: not so long ago, the language's development team introduced Strong mode. This beefs up the ‘soundness’ of Dart’s types through both static analysis and run-time checks. If you’ve used Java or C#, you’ll be familiar with the static typing. This prevents runtime errors such as fetching a stream from a list but getting another type and throwing an exception (on mobile apps, an uncaught exception kills the app). Strong mode is optional in the first version of the language but an integrated part of the second.
Server-Side
Anyone who scoffed about JavaScript becoming a server technology ten years ago would be surprised at the traction it eventually earned in that particular arena through
node.js. In a similar fashion, Dart can be used to write HTTP servers, and there are third-party products such as
Aqueduct, billed as “an extensible HTTP framework with integrated ORM, OAuth 2.0, and test libraries” that runs on the Dart VM. Given how web, HTTP servers and mobile apps all possible in Dart, it’s potentially a language worth your time if you’re a sysadmin or other IT administrator who needs to set up some infrastructure.
Conclusion
I believe the conditions are right for Dart to become better known, even though JavaScript (despite its flaws) is not going away (the NPM
registry, the package manager for JavaScript, has nearly half a million packages and is used by seven million developers each month). Because you can easily convert Dart to JavaScript, you can use it in pretty much everything; and its modern features might make your development process that much easier.