7 ms·
Any idea why Flutter uses Dart language which is rather obscure. Wouldn't Java or JavaScript be the better choice in terms of adoption?
by piokoch 8y ago
Any idea why Flutter uses Dart language which is rather obscure. Wouldn't Java or JavaScript be the better choice in terms of adoption?
- thefounder 8y agoYou need to know Dart/Flutter's history to understand. For once Dart exists because JavaScript sucks(or at least it sucked more when Dart was released)
- m_sahaf 8y agoThey published an article elaborating why they went with Dart: https://hackernoon.com/why-flutter-uses-dart-dd635a054ebf https://hackernoon.com/why-flutter-uses-dart-dd635a054ebf
- mekkkkkk 8y agoI might be wrong, but I think Flutter was conceived during a time when Google was pushing hard for Dart. They even pushed for including native Dart support in browsers. Google probably still considers Dart highly relevant, especially since the upcoming Fuchsia OS seems to rely on Dart (and Flutter) for its apps.
- pjmlp 8y agoFuchsia devs appear to be now experimenting with alternative UIs, given the introduction of Scenic and an experimental Rust UI framework.
- hajile 8y agoFlutter sits half-way between those two. It's more structured than JS with static types (and without all the JS oddities). It's also lighter syntax than Java with type inferencing and real first-class functions (and not everything has to be an object). The syntax is very familiar, so picking up the language is easy (Swift is syntactically quite similar). Dart doesn't have the library issues like JS or the bloat like Java. In addition, Dart is an ECMA spec (like JS), so there are no copyright issues like with Java (other companies can even get committee members if they really wanted to invest in the language). Dart was designed to prevent all the dynamic coding techniques that make JS slow (you can write very fast JS, but not in a normal style). Dart should be able to perform about as well as Java (it could beat Java on some benchmarks a few years ago). https://www.nikolaybotev.com/blog/dart-vs-java-the-deltablue-benchmark/ https://www.nikolaybotev.com/blog/dart-vs-java-the-deltablue... When you consider Java is multi-threading while the Dart implementations generally are not, performance is quite similar in the benchmark game too https://benchmarksgame-team.pages.debian.net/benchmarksgame/faster/dart-java.html https://benchmarksgame-team.pages.debian.net/benchmarksgame/... Off-topic, but for the pidigit test, Java just unloads all the work to a C lib. How is that a Java test? Any language will be "fast" if they are actually just leveraging highly-optimized C libs.
- orbifold 8y agoRe: Java / C usage: Generally I think this is a valid approach. Most languages use a C/C++ runtime for core data structures and abstractions. Go and Rust are notable exceptions. Ideally as a developer you are able to extend this core functionality in a seamless way. Python, Lua, JavaScript (the v8 implementation at least) and Java (JNI) are good examples where this is easily possible.
- hajile 8y agoI agree completely for day-to-day use, but the benchmark game is specifically to test implementations. If you're offloading to C, then you're testing the C implementation and the FFI implementation instead of the language implementation. If you want to test those, then come up with a specific test for that.
- igouy 8y ago> … testing the C implementation and the FFI implementation instead of the language implementation… No, not "instead-of" but "as-well-as".
- simplify 8y agoThat all makes sense, but it's disappointing to see that Dart is no better than Java in type safety. Every type is nullable (the billion dollar mistake), and the type system is too weak to support mildly advanced data modeling without requiring heavy OOP. Dart is a pain to work with. But to be honest, Flutter makes it worth putting up with.
- hajile 8y agoNon-nullable types are in the works. I'd love for Standard ML to become popular as it offers all the things in a pragmatic package. The ML languages (and their hindley-milner roots) have sat around for over 45 years without being adopted into the mainstream. At some point you have to admit that the world isn't ready for a great language yet and go with something that is a step in the right direction. If I have to use a lowest-common-denominator language, I'll take Dart over Java any day. The syntax is better, first-class functions with closures are far superior to anything Java offers, decent type inference, etc are all steps closer to SML and make life easier.
- deleted 8y ago[deleted]
- pjmlp 8y agoLast hope to make Dart relevant outside Google AdWords team. Fuchsia also uses Flutter and Dart for the UI, but they are now playing with alternative UI engines and the Android team is adding support to run ART on top of Fucshia.
- skybrian 8y agoBecause the Dart team was willing to change the language to help the Flutter team. Popular languages already have a killer app and wouldn't be willing or able to do that.
- tretiy3 8y agoit might be wrong, but i heard that dart team are same guys which developed v8
- coldtea 8y agoBecause Dart allows static typing for speed (not just for checks), AOT compilation, and hot reload. Java does the latter badly, and Javascript doesn't do static types and AOT (with the possible exception of someone's custom bizarro Rube Goldberg JS compiler). It's also simpler than Java, saner than Javascript, and more under Google's vision and control than either.