
Angular 2 First App Post-Mortem - Halienja
https://medium.com/@MikeRyan52/angular-2-first-app-post-mortem-b2b2b3618828
======
randlet

      I leveraged the Flux architecture powered by the 
      immensely popular Redux library. For a cleaner 
      integration with Angular 2’s injector and TypeScript’s 
      type system, I wrote a class-based wrapper around Redux
      that exposes state changes using RxJS observables. 
      Consumers can subscribe to these observables and use the 
      Store class to dispatch state-changing actions.
    

This reads like a Markov chain generated from a pool of top voted Hacker News
Javascript submissions.

~~~
Geee
Hah. Just the other day I was swearing about the Javascript trend that there
is always an obscure thing X that solves obscure thing Y. And then there's
huge hype about it.

------
runin2k1
I hate to be cynical, but reading an article like this makes me chuckle to
myself thinking about how much vitriol is still spewed at Java for its over-
engineering dark ages.

I start to have flashbacks when an innocent sounding article like this has so
much word soup that it has to be cross-referenced against half a dozen other
technologies.

For Javascript's sake, I propose we skip the phase where we implement
Enterprise JS Beans, and go straight to Spring JS so we can all finally get
some work done.

~~~
leeoniya
"All problems in computer science can be solved by another level of
abstraction...except for the problem of too many levels of abstraction." [1]

BTW, if you want less framework-ness. Try a lightweight vdom lib. I worked
with Mithril [2] for a while but after a few projects decided that MVC was
poorly suited for front-end components. I'm writing what IMO is a great vdom
view layer that's extremely fast, ~8k min, flexible (imperative/declarative),
pure js and pleasant to use [3]. Feedback welcome :)

[1]
[https://en.wikipedia.org/wiki/Indirection](https://en.wikipedia.org/wiki/Indirection)

[2] [http://mithril.js.org/](http://mithril.js.org/)

[3] [https://github.com/leeoniya/domvm](https://github.com/leeoniya/domvm)

~~~
faizshah
I like it!

Can you add a comparison section to mithriljs and/or infernojs (the current
leader in vdom performance)?

Also an example for routing would be nice.

Keep up the great work!

~~~
leeoniya
perf is 2x mithril and 1x inferno at high mutations and "only" 0.5x inferno at
low mutations. "only" because domvm gets 70/s vs inferno's 135/s on my i5 cpu
on dbmonster at 1% mutation.

however, domvm views support isolated redraw and even granular node-level
patching. so you can optimize much faster if needed

see here: [http://mathieuancelin.github.io/js-repaint-
perfs/](http://mathieuancelin.github.io/js-repaint-perfs/)

no routing yet, but some plans are brewing...wip :)

------
cheez
Uh... I'm relatively new to JS but why the heck are you mixing Redux and
angular?

~~~
bgnm2000
Redux can be used in any javascript app. Its a pattern, not something stuck to
react.

~~~
cheez
True, but with redux and angular, now you have two things where state could
live.

~~~
nilliams
You have 2 possibilities yes, but afaict Angular 2 doesn't push you to use
'its way', unlike the early days of Angular 1 where 'the way' to do state was
$scope.

So I could see how you could comfortably use Angular 2 with Redux as long as
your team was on-board to always do state the Redux way.

~~~
cheez
Give a developer an inch and they'll take the football field. Maybe that's an
acceptable risk, but I wouldn't take that risk.

------
EvanPlaice
As somebody who has been writing an Angular2 app in ES6, it kind of saddens me
that Google has gone all-in on Typescript despite it's glaring departure from
future web standards.

Specifically, the parameter annotation syntax they use is much different from
that proposed in the future ES7 spec.

I really like Angular2 but it's hard not to feel like it was created as a
promotional tool for Typescript adoption.

Types in JS are mostly 'window dressing' to protect devs from themselves and
allow for better autocomplete support. They come with a performance overhead
so they'll be disabled in production anyway.

Anyway, it's very interesting that Op went with Redux. Redux is pretty game
changing in terms of reducing the feedback cycle between changes. Hopefully,
better Redux support in NG2 is forthcoming.

~~~
Matthias247
Types come with a performance overhead and will be disabled in production?

Sorry, I don't understand that. Typescript transpiles to plain JS, so there
are no types at runtime no matter whetzer you are developing or in production.
And therefore there is also no performance overhead. The only overhead I can
think of is if you are transpiling code at runtime instead of build time using
some JSPM plugin - but then the overhead is not related to types but to
transpiling (it would also be there for typeless coffeescript transpiling).

And I also thought that typescript decorators are explicitily following the
most recent ES7 decorator proposals and are even marked as experimental in TS
to be able to react to changes if the ES7 syntax changes.

