Well, I'm glad they bothered to keep upgrade paths in mind. That was one of my biggest concerns from the 2.0 announcement.
ngForward looks especially interesting, particularly for those who are still stuck with IE8 support.
However, I don't think I'll see myself using angular 2.0 personally. After react, mithril, riot, etc. I just don't find the boilerplate you have to use with 2.0 very attractive.
After using typescript for the last year... I can't see going back. It has caught so many typos for me, and code completion makes things go so much faster.
Quite a few bugs previously, I submitted many bug reports to Jetbrains, but as of the current version 11.0.2 it seems to work very reliably.
And by the way, WebStorm recognizes inline JSDoc type hints (in additon to all the normal JSDoc):
let /**string[]*/ a;
From now on this is an "array of strings" (I prefer the short notation over Array.<string>) - for the code inspections as well as for completion. If you want types, with WebStorm and an IDE and/or tools recognizing JSDoc type info you get them with regular Javascript.
WebStorm, VS Code, and Atom all provide a very similar experience when working with TS, because the plugins are all built on top of TS' services.
Dart's tooling works the same way. The heavy lifting is done by the SDK's analyzer which is used by all plugins.
New languages should definitely copy this concept. It's the most efficient way to get top-notch tooling into all kinds of editors and IDEs. It also makes it easier to keep those plugins in sync with language changes.
One of the nice things about typescript at least is you can "progressively type". That is, you can write vanilla ES2015 and then add in types at whatever rate you're comfortable. It's even somewhat common to write pure ES6 and then add types after the fact, so you can take advantage of the dynamic nature of javascript while developing, and then solidify the API after you're good with it.
no, not harder. Just remove types (you don't need to use them in TS) and you'll get (almost) vanilla es6. Initial code conversion is as easy as changing file extension from js to ts.
Do you mean the decorators (@Component(), @RouteConfig(), etc)? I find it really easy to see the configuration of a component right at the top like that. Also the new DI stuff is pretty amazing.
I mean in general. I commented on an angular 2.0 example not too long ago here in another comment about it if you'd like to know more about why I think it's boilerplate-y.
I understand where you are coming from. And writing code like that is not for everyone. To contrast your example with Mithril, I feel a lot more comfortable writing explicit code like Angular2, rather than trying to grok everything going on in that feature packed Mithril example. The thing with making something so explicit is that you can later add some more sugar to it and create even more conventions that you don't need all the boilerplate. You could easily write your own decorator which extends the @Component decorator to make all of that less boilerplate-y.
I was listening to a live video chat with the Angular2 team saying that one of their team members, Viktor, is working on something like that already. Making a "shorthand" version to write components where you'll need the implicit knowledge of what's going on.
As of alpha.43ish they automatically include the core directives now, so no need to provide them.
That "feature packed" mithril example is just three function calls, one of which is Array#map. There's also nothing implicit about it; I am explicitly making the element and then calling the child component directly. I guess you could say the default export is implicit if you really wanted to, but it's standard ES6 modules to me.
However, I'm glad to hear they're taking steps to reduce the boiler plate. CORE_DIRECTIVES was such a huge code smell to me, I have no idea how they didn't catch that sooner.
I was under the impression that your mithril example was analogues to the Angular2 example. The @Input and @Ouput setup the interaction for the component that is being created. So assumed that what you wrote did the same thing, which is why I thought it was more implicit than what it is. We both obviously prefer different things, which is cool :).
I should be more clear then. It is analogous; they would do the same thing, just in the ways that each framework prefers. The angular example happens to set up a lot more because that's what angular requires, but they would render HTML that achieves the same thing.
The angular example uses @Input and @Output to mark how the data binding occurs. However, Mithril doesn't do databinding - the second parameter I pass into m.component is all of the arguments that component takes (it becomes the second argument in that component's view function). That takes care of @Input, and @Output is handled simply by referencing javascript variables in scope.
This is no less explicit than the angular one, just I am consuming my component directly instead of through HTML templates. I can definitely see how it wouldn't be for everyone, as there are still people who don't want templates with the javascript - and of those who do, even less who are willing to drop JSX (or MSX in this case) and just use pure function calls.
26
u/wreckedadvent Yavascript Dec 15 '15
Well, I'm glad they bothered to keep upgrade paths in mind. That was one of my biggest concerns from the 2.0 announcement.
ngForward looks especially interesting, particularly for those who are still stuck with IE8 support.
However, I don't think I'll see myself using angular 2.0 personally. After react, mithril, riot, etc. I just don't find the boilerplate you have to use with 2.0 very attractive.