I was wondering if there are any tips or documents describing dart workflow to easily migrate from Closure tools background to Dart. I am especially interested in a replacement for soy templates and internationalization. What would you suggest for those as well for some of the bigger parts there (like control / component).
The Dart internationalization library is modeled after Closure's, so it's probably a pretty easy replacement, although not everything is finished yet.
I took a brief look at Closure tools documentation and soy templates.
I haven't seen something similar in Dart.
Dart i18n is WIP and still a bit rough around the edges.
The best template/component technologies available for Dart are IMHO AngularDart and PolymerDart
but I don't think there is an easy migration path.
Related
Hello Dart Community,
I am curious to know the practicality of using a javascript library (say a visualizing js like D3.js, etc) within your dart app?
I currently am building an app that tries to take data and do some analytics. To do this, I would like to visualize the data clearly.
I know there is js dart interop. https://www.dartlang.org/articles/js-dart-interop/
Does this have a good enough functionality to be used in communicating with a robust JS library? What is the catch?
Thanks!
This is used a lot. Just take a look on the questions here on SO dart-js-interop. It's not too comfortable currently but thre is work going on to make a better developer experience.
There are Dart packages that provide wrappers for d3.js. I have no idea how well they work though:
https://pub.dartlang.org/packages/charted
https://pub.dartlang.org/packages/d3d
https://pub.dartlang.org/packages/d3
At least the code can give you and idea how to use d3 from Dart.
I'm prefer using wrappers to use js libs to avoid use dart interop in all places in project.
The worse functionality using JS libs is when lib is a JS polymer component. You may be would to generate wrapper with custom_element_apigen.
For other js libraries you can write wrapper with your forces. You can use some wrapper generator too but I never have this experience.
I've been using the F# powerpack for some time and it's got the great PSeq module in and it works really well.
However it doesn't smell correct as this is an extension to the F# libraries, rather than a standard library. Is there a more 'correct' way to perform general parallelism in F#?
I know this is quite a general question, but I can't seem to find a definitive answer anywhere else that is recent (eg 2013)
As mentioned in the comments the PSeq module is just a thin wrapper over the Parallel LINQ library. The main purpose is to give you a nice syntax, compatible with pipelining and the style used with Seq and other standard modules.
So, if Parallel LINQ is the right thing in your case, then PSeq module is the best way to use it from F#. That said, PLINQ only improves the performance if your collections have the right structure - you need to process fairly large collections and the operations that you are running are non-trivial (otherwise, there is a lot of overhead).
Also, the easiest way to use PSeq is probably just to copy PSeq.fs and PSeq.fsi into your project (they are part of the F# PowerPack, but if you only care about PSeq, then copying the two files is all you need).
I'm starting to study Dart. It seems a nice language and in some aspects a real improvement over JavaScript. Since it claims to come with "batteries included" and to be meant for "structured web apps", though, I fail to understand how to actually structure a web app with it. Almost all the tutorials concentrate on language features, but Dart is quite simple and with many familiar bits, so that's the easy part.
Recently I fell in love with AngularJs. Now routing, two way binding, nested scope, clean separation of concerns... This actually means "structured" to me. But all the Dart examples I find are about selecting HTML elements and attaching listeners to them. This is old-style jQuery-like web programming and quite frankly the opposite of what I think of when I read "structured".
I don't want to compare a language and a framework and I know that Angular Dart is out, but I fear I'm missing something of vanilla Dart, because if it's all about a shorter syntax for lambdas, class based OOP vs prototypical OOP and the like, I don't see how it's supposed to be a game changer: there are many other languages that provide an alternative JS syntax (à la CoffeeScript) and compile to it, and they don't come at the price of losing a perfect integration with existing JavaScript libraries and tools.
Sure, it has optional static typing, which may be great, but this comes more to a matter of preferences. I'm a full time Python and Ruby developer and I'm perfectly fine with dynamic languages. Is this what they mean by "structured"?
Thanks for any clarification that will eventually come.
I work on AngularDart and have some experience structuring web apps.
When building a web app in Dart you would pick a web app framework, for example AngularDart or polymer.dart. Web app frameworks have a lot of opinion which is something that doesn't fit in the core libraries. In that respect, "vanilla Dart" is fairly vanilla.
Since I'm most familiar with Angular, I'll discuss the Angular + Dart combination. However, the rest of this post is also true for polymer.dart.
Angular provides a lot of structure to your app. We've been able to provide a similar structure for both Dart and Javascript. The concept of directives, data binding and dependency injection exist in both.
Dart provides more structure and we've been able to use that structure while building AngularDart. e.g. the directive API is defined in terms of annotations which means that IDEs understand them and can help you code.
There are a number of "structure" features in Dart. One of my favourites is tooling. With types and annotations comes better tooling support.
Types in Dart are most useful when combined with tools. Auto-complete is great but for large web projects, static analyze is even better. For example, in AngularDart, since directives are annotated classes, we can assert that the annotation is correct. Even more interesting is the potential to build tools. In AngularDart, we have a tool that extracts and analyzes all directives. This type of tooling is possible in Javascript but easy and supported by the language in Dart.
libraries, packages
integrated dependency management with pub package manager
class based instead of prototype based
scopes of variables as one would expect in a modern language
static syntax check
better tooling support like code completion
I've been a java developer for most of my career, and developed and maintained some pretty large code bases.
now that I've been developing in rails for a while I've left my IDE behind and I want so start looking at the actual rails source. I've mainly been using the github interface which is actually quite good but I wondered if there were tips and techniques from more seasoned ruby devs?
What I'm missing mainly is my trusted eclipse features like "find usage" or "goto implementaton". Perhaps a paradigm shift is in order... please enlighten me :P
Since you're an Eclipse user I'd recommend Rubymine. It gives you a lot of the same features and has good integration with rails. It has good support for jumping to implementation/usage, although this is a harder problem in ruby than java. When Rubymine can't determine which implementation is the correct one, you're usually given a list of all matching methods.
I personally use Vi and haven't had trouble navigating rails projects, usually it's a matter of convention and familiarity that just comes with working on the same project for enough time. I default to using grep or find for usages etc.
The problem is that things like "goto implementation" and its ilk may require deep knowledge of the runtime. Some methods may not exist until after an initialization or mixin process. Duck typing means that anything that responds to a message is a potential type candidate.
I'm reasonably happy with IntelliJ (Rubymine), but you won't find the same level of navigational support you get from a language like Java, where most everything is known up front. It's simply less navigable than Java code, IMO.
The things that can be known, like explicitly-defined methods, "obvious" calls, and so on are navigable, and IMO right now IntelliJ does it the best, but I haven't used an Eclipse Ruby environment for some time, so the situation may be different now--but I'm often surprised at how well it does do, considering the circumstances.
That said, I flip back-and-forth between IntelliJ, TextMate, Sublime Text 2, and Emacs. TextMate is nearly useless to me because of its single-pane design. For quick stuff or small projects, it's adequate.
Is anybody aware of a possibility to use C# libraries like OpenTK (http://www.opentk.com/) from F#, too?
I'm especially interested in a Math toolkit library to give some scripts extra speed by taking advantage of the GPU from within F#.
What's a painless way to do that? :)
As Juliet mentions, you can use any .NET library from F#. Talking about OpenTK specifically, there is some material written by Laurent Le Brun (however, all of them are about graphics and not math):
An introductory article: F# + OpenGL: a cross-platform sample
More examples are in the samples/opengl directory in the F# cross platform project on CodePlex
It's probably not exactly the same thing as you're looking for, but it should help (e.g. if there are some tricky things that need to be done when using OpenTK from F#)