Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Angular Family Feud Unleashed: Dart vs Typescript

DZone's Guide to

Angular Family Feud Unleashed: Dart vs Typescript

There are several languages that web developers can use along with Angular. Read on to find out which one is best for you!

· Web Dev Zone
Free Resource

Start coding today to experience the powerful engine that drives data application’s development, brought to you in partnership with Qlik.

Image title

“Your sister is more focused!”, one might hear parents tell their son. “Maybe so, but I am more versatile!”, he’ll fire back while thinking about how serene his life used to be until she came along. A typical sibling rivalry… Unfortunately, many times there appears to be a favorite. Such seemed to be the case with TypeScript and Dart, at least at first. The oldest sibling, JavaScript, also had his feelings hurt.

Image title

For a while, Angular, the master of front-end development, was using JavaScript (JS) and TypeScript (TS), but then a new sibling (baptized as “Dart”) was born into the Angular family. Did she appear just to complicate things as many women do? Actually, her idea was to win her parents over completely: she wanted to get rid of her oldest brother at least, but in the end, her folks saw there was room for everyone -- they simply needed to be kept separate enough. After all, each one had unique characteristics that made them equally valuable.

Image title

Indeed, Google created Dart in October 2011 with an intention of replacing JavaScript. This new creature was meant to have her code compiled into JavaScript code and thus work on modern web browsers. So what’s the point of having her then if coding can be done directly with her oldest brother, JavaScript? The answer is simple: she was a language made for structured web programming. Before her birth, the only option for client-side application building was JavaScript (well, there was also a bastard child, Flash with ActionScript, but we won’t go there now), but he couldn’t live up to the demands of the modern family. Yes, his mission in life was to add some basic interactivity to web pages, but current large-scale apps need someone more powerful. Thus, the Google parents decided to go for one more child, and Dart was born.

Even though Dart has managed to find a place in some developers’ hearts, she is not the ideal partner for everyone. Thus, there is still room for brother TypeScript left in the family! He still provides unrivaled ease of coding to those who remain faithful to JavaScript (who himself has evolved thanks to tools like JSjet -- who in turn allows for linters use -- and JSHint). Being its typed superset, it allows for current projects written in JavaScript to be converted into TS by simply changing the extension on the source file from “.js” to “.ts”, which makes it very helpful with your long-term projects. Your type is safe with him: he’ll help you uncover errors that happen when you have to transpile it. This lets you eliminate them early enough to fight regression problems -- an essential feature when it comes to maintainability. True, his older sibling JS is capable of cleaning up his act too with a debugger inside Webclipse, but he is also kind enough to provide his full support for inheritance and interfaces. As a result, you get an improved OOP experience (which comes hand-in-hand with a much better code decoupling and reuse). Besides, if you’ve been developing with C# or Java, he’s your guy!

Well, I must admit, there is nothing perfect in this world, and Mr. TypeScript may not be “Mr. Right” for everyone -- he might be hard to handle if you are lacking experience with statically typed languages. It can also get a little messy when trying to apply TS definitions to non-TS libraries, and you can’t run him without a previous compile stage. And of course he’ll refuse to fix any mess you and JavaScript had made, but hey -- that’s your fault, not his!

In reality, both regular Angular and AngularDart share a template syntax and even APIs, wherever possible. Yet, at the same time, the family fight has brought cleaned-up JavaScript APIs -- and thus, a more user-friendly working environment -- since the TypeScript codebase was simplified (now it’s not necessary to compile to Dart). Some family feud can do good sometimes!

Will more members be joining the Angular family in the future? Time will show. Meanwhile, we can enjoy the company of the existing ones. Now, the question is, “Who is right for you?” Well, it’s up to you to decide based on your needs and experience.

Create data driven applications in Qlik’s free and easy to use coding environment, brought to you in partnership with Qlik.

Topics:
typescript ,javascript ,angular ,webdev

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}