4 ms·
> Dart feels like a better TypeScript That's only if you use Typescript as a class-based OOP language. If you're more used to functional programming and protot
by leppr 8y ago
> Dart feels like a better TypeScript
That's only if you use Typescript as a class-based OOP language. If you're more used to functional programming and prototypal inheritance, then Dart will bear no familiarity.
Due to its adherence to classical OOP, it feels way more like Java than Javascript.
As someone who never did any serious programing in those classical OOP languages, I struggled a lot to find the right abstractions to implement any kind of clean business logic. It was the first time I had to actually read up about "design patterns" and unironically consider writing factory factories.
It seems that due to Dart's rigidity and adherence to classical OOP, any library which needs to deviate from this paradigm has to hook into an additional build step (e.g. built_value for immutable types, has to use build_runner). That's an acceptable compromise for lib users, but adds a huge burden to actually writing those libraries, let alone incorporating those in your app's code.
- skybrian 8y agoYes, Dart is a fairly standard object-oriented language, but this exaggerates a bit. Dart has first-class functions (unlike Java) so you shouldn't need a factory-factory in the simple case. That's just a function that returns a function. You might need other design patterns, though.