10 points · by antoaravinth · 11y ago · 32 comments
We are going to migrate our vanilla js application to either React or Angular world. Given that our application is an CRUD based application, we need to know which one is good/best.
I know React is not "MVC" pattern in itself, but with Flux it is comparable to Angular ( correct me if I'm wrong here). I have seen Angular 2 is coming up which is going to remove the existing feature that are in Angular 1.x versions. So we fear whether angular is right choice "now" for us! Because our UI is already an complex, we don't want to change our code-base when Angular 2 comes up. We don't want to do that at all.
And interestingly we yet to "learn" Angular / React given the choice; So learning curve also going to be an matter for us.
Given these facts, which framework HN will be suggesting for us and why?
Thanks a lot for all your reply.
It is already "dead". Of course the existing projects will remain, but create one on a framework you know will not evolve ever again soon doesn't sound like a right move.
Granted given the speed of change in front end whatever you chose will probably disappear in a few years. :/
Angular 2 is looking pretty awesome, for the record, and is something on the order of 10-15 times faster than React or any other modern framework out there. I would check your assumptions and look at things objectively.
Does "to migrate" mean "gradually refactor and gradually pack code in React/Angular components". Or does it mean "to rewrite from scratch"?
How big is the application?
Does it have clear architecture and clean code or is it big ball of mud with ugly looking code?
>> How big is the application? Yeah its pretty big. Has at least 7-8 different pages and workflows.
>>Does it have clear architecture and clean code or is it big ball of mud with ugly looking code?
The code is in "somewhat" good state. Few components we have followed MVC using vanilla js; where as few components still remain the same ( as ugly looking code )
So I think that React way of using plain old JavaScript as a DSL for creating HTML components is indeed more elegant and more expressive that Angular way of injecting an artificial created and limited DSL and chunks of JS-like code to HTML trying to figure out how to make things properly.
Maybe a good place to start is with one of those boilerplate repos that have React + build tools already set up: https://github.com/gaearon/react-transform-boilerplate... Then you just add the stack that you want, like redux and react-redux with npm install.
React + Redux for the Flux pattern seems to be the best combination available right now. Watch this talk by Jessica Kerr - Functional Principles In React https://www.youtube.com/watch?v=1uRC3hmKQnM about why Functional / Declarative approach is good for front end development. Also Dan Abramov (Redux Author) Talk - Live React: Hot Reloading with Time Travel https://www.youtube.com/watch?v=xsSnOQynTHs introducing Redux is great.
Watch this awesome talk by Ryan Florence - Don't Rewrite, React! https://www.youtube.com/watch?v=BF58ZJ1ZQxY on how to approach rewrites bottom up and he rewrites a part of the TodoMVC written in Backbone.js.
React will give you better performance and server side rendering. It mixes the view in the javascript which can be a little off to some.
Angular will give you a larger framework with two way data binding and likely faster dev cycles. There is a roadmap to 2, but until then no server side rendering and issues with performance if you aren’t careful.
Faster dev cycles than React? Why do you think so?
Maintaining/developing every application can be pain in the ass because of its complexity. Speed of development cycles depend not only on technology stack, but also on good architecture, quality of code, inter-team communication and even a proper build scripts.
Off course framework also plays it part, but I don't know if Angular really is better to develop in. Actually I think that developing in Angular 1.* is pretty cumbersome and there is constant need of creation creative hacks.
React - Hello World is also super easy but it's good to know about ES6, Gulp/Grunt and Babel (it's not necessary though. You will have just more syntax sugar). As you go deeper in React you’ll have to get familiar with recommended architecture and principles for React (flux architecture, unidirectional data flow, immutability etc.) and because React is only view/rendering part, you probably will be wiring React with something else (e.g. Redux or other library for keeping state and dispatch actions).
In other words: using Angular you'll have to deal with complexity of framework API but app architecture will be determined and forced by Angular. So probably you don't have to be good at programming to do Angular.
Using React you’ll have to understand its architecture and functional(immutable/without side effects) programming, but API itself is super simple. And there are super helpful error messages if you mess up something.
Guess the learning curve of Ember is also easy.
First of all, please remember that nothing is faster than a properly written vanilla js application. Every layer of abstraction you add will necessarily slow your app down. You gain convenience at the cost of performance.
So unless you're dealing with major issues in terms of complexity and understandability, I would ask yourself why you need to have a shiny new framework in the first place?
But let's assume you do. You're in the same boat that a lot of companies and developers are in these days - what the hell framework do I choose when a new one seems to pop up every day? Spoiler: there's no right answer. I assume you want your app to be future proof, which is a fools errand, but supposing you're a fool like the rest of us then my humble advice to you would be to read up on web components and choose the framework that embraces them the best.
That would narrow your choices down to Angular 2, Polymer, Aurelia, and probably some other less mainstream frameworks I haven't heard about. Angular 2 would be a fine choice but it's going to be a pretty radical shift to the way people do things, but it will come with a reward of up to 10-15 times the performance of angular 1.+ and react. Oh, and it's not ready yet.
Aurelia takes a lot of its queues from Angular 2 but it's basically production ready today and far simpler in terms of its complexity and API. It's all-in on web components and has a very enthusiastic and helpful community surrounding it.
Polymer is Google's big bet on the future of web development. It's at 1.1 and production ready, and will be extremely well funded for years to come. It's basically sugar for creating web components. It's similar to React in that they encourage you to build your application out of nested components. It's different from React in that it embraces the web components spec and the DOM. React has explicitly stated multiple times that they have no interest in web components.
Polymer isn't quite as simple to get up and running with as React and Google needs to address that, but it's getting better. But the big thing the polymer team has going for them is that they literally share desks with the Chrome dev team, and as such they have their finger on the pulse of cutting edge web browser technology. The React core team doesn't have that luxury, so they've taken the radical approach of trying to abstract away the DOM completely. It's an intriguing approach but in my humble opinion it's hostile to the open web. Make no mistake that Facebook is doing what's best for Facebook. Google is doing what's best for Google, too, but that happens to align with the goals of the open web.
Anyways, I hope you don't just jump onto the React bandwagon before giving your research a little more time. HN is an echo-chamber and the word "React" is just the latest echo you see bouncing around.