Recs.
Updated
Dart is an application programming language that’s easy to learn, easy to scale, and deployable everywhere.
SpecsUpdate
Pros
Pro Actively developed and maintained
Dart is actively developed and maintained by Google and used by the company, ensuring good project health (even if their plans for the language have changed slightly).
Pro Great async language support
Dart is a single threaded programming language. So if any piece of code blocks the execution of the program, the program practically freezes. To avoid this Dart makes use of asynchronous operations which let your program run without getting blocked. This is done through Future objects.
A Future is an object which represent a means for getting a value at a certain point in the future. A function may invoke a Future and when that happens, two outcomes can be achieved:
- The function is unable to return a value, so it queues up work to be done and returns an uncompleted Future object.
- Or later when a value is available to be returned, the Future object completes with that value.
Pro Supports privacy without verbosity by avoiding the keywords public, protected, and private
Every Dart application is a library, even though it doesn't use a library directive.
Libraries not only provide APIs, but are also a unit of privacy. Although in this area Dart is a little bit different from other languages as since is does not have the private
, protected
or public
keywords. Instead Dart uses underscores (_) to denote private functions or variables.
For example: foo()
is a publicly available function and can be accessed when the library is imported somewhere else. If you want to keep this method hidden, you add an underscore: _foo()
and it behaves like protected, now it can't be accessed when the library is imported somewhere else.
This helps with having less verbose and easier to understand code
Pro Strong typing combined with tooling to make use of it, significantly improves productivity
See, e.g., these two videos from the recent Summit: Sound Dart and fast web dev.
Pro A very clear well thought standard library
Out of the box, the developer gets core libraries to help with async, collections, strings, regexps, conversions, formats, file I/O, math, typed data, and more. This reduces the need to pull in various 3rd-party utilities and ensures that all Dart code looks and feels the same.
Pro A lot of tools are available to help in developing with Dart
Dart has a lot of tools available which help with developing Dart applications. Some examples of those tools include:
pub - package and dependency management and build tool
analyzer - static syntax analysis with linter, quick fixes, autocompletion support for easy IDE integration
test - powerful and flexible testing framework and test runner
dev_compiler - generate reusable JS instead of tree-shaken minified JS output (work in progress)
dartfmt_ - source code formatter
server-side VM
observatory - a powerful tool for profiling and debugging running Dart code (for Dartium and Dart server code)
Pro Support of semi-coroutines (generators)
Generators, also known as semicoroutines, are also a generalization of subroutines.
Generators are primarily used to simplify the control of iteration behavior of a loop, the yield statement in a generator passes a value back to a parent routine.
A generator is very similar to a function that returns an array, in that a generator has a certain number of values. But instead of building and returning an array that contains all the wanted values, a generator returns them one at a time, this saves memory and allows the caller function to start processing the first few values immediately.
Pro Great standard library
Dart includes a truly comprehensive core library, making it unnecessary to include disparate, external resources for basic functionalities Other than reducing the need to pull in various 3rd-party utilities this also ensures that all Dart code looks and feels the same.
Out of the box, the developer gets core libraries to help with: async, collections, strings, regexps, conversions, formats, file I/O, math, typed data, and more.
Pro Transpiled JavaScript code works on all browsers
In Dart many browser differences (subtle differences and also missing features) are abstracted away or polyfilled. When Dart is transpiled to JS the output works on all supported browsers. There is usually no need to load polyfills or to consider browser differences during development. No need for libraries like jQuery to make the same code work the same on all browsers.
Cons
Con No strong community involvement in the work on the specification, grammar, language
Dart developers rarely take suggestions on improving the language in consideration. Although the developers have been suggesting changes since 2011 in the mailing list, these suggestions are rarely included in the Dart Enhancement Proposals (DEP) which is mostly written by Google engineers.
Some people in the Dart community feel that this is inadequate since a lot of programmers who are part of that community are highly respected engineers and professionals who may have valuable input to give.
Con Doesn’t generate consumable JavaScript at present
Dart builds to JavaScript but the entire app needs to be built to JavaScript at once for now (that may change in the future).
Con May be difficult to use some JavaScript libraries
Dart is much more than a programming language, it's a platform with its own standard libraries and tools. It's a major departure from JavaScript itself (even though it can compile to JS) that it's not possible to directly interact with JavaScript libraries in Dart. Instead, you have to use a special interop library which exposes the wrapped versions of the JavaScript objects that you are accessing.
While this enables Dart to sandbox JavaScript so that its problems do not leak into a Dart application, it also means that it may be cumbersome to use libraries which don't have a wrapper library available.
While this will always be an issue when compiling to JavaScript, JS-interop has improved a lot lately.
Con Dart SDK does not provide standard (out of the box) way to access SQL-based databases on server side
This missing (but very popular) feature requires to use 3rd-party packages developed by the personal enthusiasts or very small groups of enthusiasts, which is not very convenient because they are all very fragmented in terms of content, the essence and capabilities.
Con Optional static type system can lead to fragmentation
Two paths lead to confusion and fragmentation.
Recommendations
Comments
Flagged Pros + Cons
Con Slow development
Many features and tools of the language that were promised a long time ago have yet to be implemented raising concerns that these promises may never be fulfilled.