by jamra · 9y ago · 0 comments
You can use webpack with Angular. RxJs is a great addition that will eventually be removed when Observables become implemented in JS. The declarative style of templates are different than JSX, but are not hard to deal with in practice. Native script allows for mobile dev, although I don't personally use it.
Before I switched to Angular, I preferred React. Now that I use this framework approach, I am much happier and have more faith that my code base will be consistent. I read somewhere that google used Angular for adsense so I think it is good enough for production use for us.
React and Redux promotes a more functional style (even though React components are classes...), and a lot of OOP people I personally met were not so comfortable with it.
Personally I love the functional concepts that it taught me, and I would never want to use a framework like Angular again. I'd rather make the leap and look into a real functional language for the frontend, like Elm, ClojureScript, PureScript,...
1. It's not. React has had classes and states from the very begining. In fact, purely functional only views came in React 0.14.
2. That said, it really does make coding, debugging, and reasoning about views so much easier. When I have a bug in my React/Redux app, I can look at the Redux state, and figure out the cause of the bug right then and there. I'm not looking for some variable that accidentally got changed five steps ago.
My bug is either in:
(a) How I went from application state n-1 to n, or
(b) How my current application state is rendered in my views
Both of these are very fixable.
...of course, I do also have stateful React views in my app, and code with side-effects, because being "pure" all the time isn't always practical. If the bug is in those places, I'm in for a much longer debug.
That's a snarky reply, but there is a kernel of truth. OO was practically invented for GUIs (Smalltalk). Throwing it out entirely on principle just makes large programs harder to understand, IMHO.
Funnily enough, React + Redux is "Global god state + functions", with a bit of dispatch sprinkled in. Not too far away really.
I definitely see the benefits of having a functional approach to defining UIs. My code is _somewhat_ clear, clearer than what it would have been with say, WinForms or something of the like. Going purely functional everywhere is just devs cargo culting.
Once I got in touch with React, I got interested in FP. Then I read the "Mostly Adequate Guide to Functional Programming" [1] and it was kind of an revelation for me.
I still do OOP, and I'm far, far away from being an FP expert, but I think if I'd take the effort to learn a real FP language then I probably wouldn't want to go back to OOP, and that's something I fear :) I've read a few blog posts from people who stated that learning FP kind of made them "unemployable", because they suddenly saw all the problems and annoyances that OOP brings with it (unfortunately I can't find the link anymore).
This quote regarding OOP by Joe Armstrong, the creator of Erlang, is quite fitting: "You wanted a banana, but what you got was a gorilla holding the banana, and the entire jungle."
My only regret after becoming comfortable with functional programming in JS (and eventually, even more robust techniques in Haskell, OCaml, and Scala) is not pushing harder for a functional approach in work projects that could have really benefited from the functional paradigm.
When you say that, what exactly do you mean by it?
We have a strictly defined state object that is used throughout our entire application. Because we made a contract with redux, every transaction is readable and transparent.
Writing tests for our UI layer has never been easier with React. While we do have local state inside some react components, when we use redux to pass state to our react components, they become extremely easy to test, because they turn into pure functions.
When using something like jQuery, you wouldn't just look at each frame of your state to determine how the UI would look, you would also have to look at the transitional states between A and B. Transitional states are much more difficult to understand because of the contextual implications.
Our UI layer is completely separate from our business logic and we get it automatically. Without any code modification we were able to target our large application into a CLI app just by adding a new UI layer.
There's certainly Redux movement, because it solves few important problems almost for free. But React isn't bound to Redux in any way.
I'm a swift / go guy mainly but I've been looking at this space for a while and the only sane approach to me looks like ClojureScript with reagent / reframe or something along those lines.
http://onehungrymind.com/build-better-angular-2-application-...
Since 0.14, React components can be functions, too: https://hackernoon.com/react-stateless-functional-components...
That is a bit of an understatement. Using the angular CLI the default is setting up a project with webpack with a single command. Webpack is wrapped in the "ng ..." commands for building and running. With "ng eject" the webpack config file is exposed and webpack is in the driver seat. It is not just "can" but it is really easy these days.
There may be reasons not to like Angular but articles focusing on AngularJS 1.x are not shining the light on relevant weaknesses.
Angular may be too late if one buys into the view that the growth in the JavaScript ecosystem has peaked or is peaking soon. My personal view is that the growth has been stunted by severe UX problems before ES6/Typescript and we are just at the beginning of an explosive growth phase with no end in sight.
Observable objects are tough to read in the debugger.
The main gotcha I found [1] was dereferencing property of an observable didn't trigger rendering. Didn't feel very intuitive to me.
Also, occasionally, I would insert a row into an observable array and nothing would happen, and I could never figure out why.
Using redux now, it's more explicit and full of boilerplate and ceremony, but I understand all the code, and there is far less magic.
For real!? This seems like either a critical bug or huge design mistake on the part of the MobX author.
I also cannot understand why you cannot make a Set an observable. It's such a fundamental part of programming!
In fact, Angular CLI uses Webpack by default.
Can you elaborate on this? I've been working on an Angular 2+ application that I think could benefit from a redux like state container a la ngrx/store. I'm curious if some of the issues you outline might also be applicable here.
Ionic, the mobile framework based on Angular mentioned in the article, actually does by default in it's `@ionic/app-scripts` that are used to build these applications.
https://webdev.dartlang.org/angular according to: http://news.dartlang.org/2017/06/a-stronger-dart-for-everyon...
Why isn't your comment Angular fanboyism?
Full disclosure: I prefer neither.
Full disclosure: I am not a web dev at all so my opinion is more valid.