Dart and it's advantage over JavaScript

Dart and it's advantage over JavaScript

Writing a web app can be lots of fun,especially at the beginning when you experience instant gratification: code, reload, repeat.

Unfortunately, finishing and maintaining a web app are not so fun. JavaScript is great for small scripts, and it has the performance chops to run large apps. But when a script evolves into a large web app, debugging and modifying that app can be a nightmare, especially when you have a large team.

This problem being solved by Dart. Dart is a open source project by Google that aims to enable developers to build more complex, highly performant apps for the modern web, server and mobile applications, and for Internet of Things (IoT) devices. It is a general-purpose object-oriented, class defined, single inheritance language using C# style syntax that transcompiles optionally into JavaScript. It supports interfaces, mixins, abstract classes, reified generics, and optional typing.

Using the Dart language, you can quickly write prototypes that evolve rapidly, and you also have access to advanced tools, reliable libraries, and good software engineering techniques.

Even though Dart is young, it already has tools such as -
Dartboard - which lets you write and run Dart code in your browser,
Dart Editor - which lets you create, modify, and run Dart apps.

A recently released SDK contains command-line tools such as a -
Dart-to-JavaScript compiler
- which produces JavaScript that you can put in any modern browser)and a Dart Virtual Machine. The latest tool to become available isa build of the Chromium browser, nicknamed Dartium, that contains a built-in Dart VM.

Top 5 Features of Dart

1. Fluent APIs easy - Libraries like jQuery have popularized a fluent design that encourages chaining calls for easier-to-read code. Dart takes a cue from Smalltalk and adds method cascades to the language, so that any API can be used in a fluent style.

2. Lexical scope - This is awesome, if you're not used to it. Simply put, the visibility of variables, and even this, is defined by the program structure. This eliminates a class of puzzlers in traditional web programming. No need to re-bind functions to keep this to what you think or expect.

3. Named constructors - Methods are great; you can name them pretty much whatever you want. However, the name of a constructor traditionally had to match the name of its class. Dart gives you named constructors for flexibility and clarity.

4. Factory constructors - The factory pattern is quite common, and it's nice to see this baked into the language. A factory constructor can return a singleton, an object from a cache, or an object of a sub-type.

5. Dart compiles to JavaScript - This is critically important, as JavaScript is the lingua franca of the web. Dart apps should run across the modern web.

Comments (0)

  • To add your comment please or

We use cookies to improve your experience on our site and to show you personalised advertising. Please read our cookie policy and privacy policy.

Got It!