@Remco, I've decided to go the Dart route simply as a replacement for GWT. GWT was very slow to work with and it usually meant missing deadlines by a long shot due to all the boilerplate involved with building GWT apps, but at the time, it was heaven compared to JavaScript (that was back in 2006 if I remember correctly). I used GWT since pre 1.0.0 because JavaScript at the time was horrible to work with and browser incompatibility was at an all-time high when GWT was developed - hence the reason GWT compiled separate JS file for each browser and each version of the browser (so would see ie6.js, ie7.js, firefox.js, opera...js, safari.js as well as each permuation of the language, etc). With that horrible after-taste of GWT and past JavaScript experiences, I decided to try out Dart as a replacement for GWT, but as a better alternative to JavaScript and it met all my needs.
I'm an ex Python developer, I dropped Python for Java due to Java having a stronger type system - had too many issues with Python-magic causing strange things in production that we couldn't reproduce locally. At the moment, my go-to language for backend development is still Java, Java is so far the language I've had the least issues with and pretty much anything you need done, there's a library for. I reckon Dart is a nice upgrade from Python, although it's still lacking the amount of packages you can get in Python or Java, but that'll happen eventually. I can't comment on Go, after going Java, I skipped Go since Java at the time was maturing nice and Go was still changing all the time.
Jan Vladimir Mostert
Idea Incubator
Dart is a really well designed language, I started using it just a couple of versions short of version 1.0.0 - it gives me the structure I love in Java without forcing me to use it (it has optional typing, so I can either declare a variable as
String aor simply asvar a) with freedom of doing what I want like in JavaScript (code will compile with warnings if it's able to figure out what you mean instead of outright not compiling and getting in my way), the asynchrony as done in C#, it has a concurrency model similar to Erlang, except that it's non-blocking, so can offer much better performance (it's like NodeJS on steroids). Everything is an object, like in Smalltalk, even null is an object, integers like the number 2 is an object and whereas in other languages you can usually only go to Integer.MAX, Dart can have infinite sized integers (until you run out of memory or if transpile to JavaScript which does have integer limitations). Functions are objects as well and can be passed around in the same way as anything. Lambdas everywhere, if you're only doing single line functions, you don't need to use brackets, you can write a single liner using Lambda expressions and the same for constructors - I've never seen any language with such flexible constructor options.Unlike JS which has many quirks, if you do something in Dart, the output is what you'd expect it to be, I haven't seen any scenarios so far where it had unpredictable behaviour, JavaScript on the other hand has left me often times wanting to scream when it stops working as expected.
Dart allows multiple inheritence with Mixins, so I can inherit one class and then sprinkle bits and pieces of another class into that class simply by using mixins. This also allows for great API designs.
I don't know if you've seen the async await syntax that was added to ES6? Dart introduced that a long time ago to get rid of nested callbacks. If you look at ES6, it seems like they almost copy-pasted it from Dart.
Dart uses properties for all variables just like Delphi used to do, so in other words, if you declare a class and add variable to it, like
class A { var abc; var def;}and do(new A()).abc, this actually calls a getter methodget abc(), you don't have to pollute your code with getters and setters - every call to a property goes via a getter / setter. You can however overwrite getters and setters - so in terms of encapsulation; everything is well encapsulated without needing boilerplate code.Just like with Python, you can override operators. Instead of having to call
a.add(b);, I can now straight out define what the plus operator should do if I doa + b.The package manger is similar to NPN, not as busy yet, but the quality of packages in general are very good often times written by Google engineers themselves.
The cascade operator is pretty awesome, I can't talk about dart without mentioning it (Delphi had something similar, but not nearly as easy to use). So typically if you want to assign values to a nested object, you'd do
a.b.c.a = 3; a.b.c.b = 4; a.b.c.c = 5;. Using the cascade operator you can doa.b.c..a=3 ..b=4 ..c=5; You have no idea how much time this saves when having to fill in data in heavily nested objects.I can probably write a million line essay on how awesome Dart is, but as they say in the Matrix,
You take the red pill—you stay in Wonderland, and I show you how deep the rabbit hole goesI've avoided Angular Dart for a bit; As you might have noticed, Angular Dart stopped development at version 1.3 waiting for Angular JS to become stable first before they continue to port it. Angular Dart 2.0 which should be going to stable very soon is where I'll pick it up again and will be very similar to Angular TypeScript 2 (the tags you us in HTML will be exactly the same).
For the last 18 months, I used pure Dart and Bootjack, a port of Bootstrap to Dart and wrote my own framework around it. There's a nice Dart library which compiles your less files for you on the fly, so as you change lines in your
.lessfiles, you can just refresh the browser and the css is already updated for you - no need to run manual grunt scripts to compile less files.Angular Dart will also be giving you access to Polymer Dart and Web Components in Dart - Web Components in Dart is a lot more powerful simply because you have a much more powerful language features available at your fingertips that can do a lot more for you than with pure JS.
I'm also doing some reading to see if I can replace some of my Java Backends with pure Dart - using Isolates in Dart, I can get the same performance benefits as many claim to get with Erlang minus the complexity - many Dart developers already claim getting similar performance levels as they used to get on the JVM with Java for things that are not IO-bound. Instead of deploy 7 - 20MB Java war files, I can deploy 200kB applications stripping out everything I don't need from packages doing the same thing my Java applications were doing. There's also the benefit of code re-use and if you look at Google's latest projects, they're planning to make Dart transpile to semi-native Android / IOS as well which means you will truly be able to write code once any use it everywhere.
Dart is absolutely focussed on productivity and since it's very similar to Java and JavaScript in terms of syntax, the learning curve is not very big.
Brilliant book if you are interested in the deeper details of Dart, I finished the first couple of chapters this morning: hashnode.com/post/new-book-by-gilad-bracha-the-da…
If you go on Dart's homepage, dartlang.org you'll see a link that says try dart, this is called DartPad, very similar to CodePen where you can test Dart code snippets. The equivalent site can be found here: dartpad.dartlang.org
Once you're ready to go all in, start here dartlang.org/docs/tutorials/get-started Install the SDK, get a copy of Web Storm (the open source one works as well) and then the Dartium browser which runs your Dart code natively in the browser so that you can develop directly in Dart, refresh the browser and see your changes without having to compile to JS first (although compiling to JS can happen automatically if you don't want to use Dartium and often takes less than a second)
If you don't like the
querySelectorsyntax of Dart and prefer Jquery, you can add the Dquery plugin to yourpubspec.yamlfile and you can call dart methods in the same way you'd use Jquery - Dquery will just wrap Dart methods.Until a year ago, I still tolerated JavaScript since there was nothing else and all the alternatives like GWT, Pyjamas, etc were just horrific to work with. Since starting to work with Dart, JavaScript started feeling the same way as I would see movies like Mega Shark VS Giant Octopus compared to Dart which would fall more in the league of Inception, The Matix, etc.
Anyway, shout if you have questions!