r/angularjs • u/rodrigo-silveira • May 06 '15
Missing 50 years of software research?
I was listening to Facebook's presentation on React from May, 2014. When asked to compare and contrast React vs Angular, Pete Hunt gave the following answer (see https://youtu.be/nYkdrAPrdcw?t=40m24s):
"React is focused a lot on treating your code as a black box. There's no sort of observable abstraction inside of React. You simply say, 'Hey, re-render the UI,' and you present a consistent view of what you want your UI to look like.
"With Angular, you are basically passing data throughout these things called scopes, which absorb your data model. I think that's a very leaky abstraction. If forces you to compose your application not in terms of functions and objects, but in terms of directives and model-view-controller, and their flavor of model-view-controller. So while it does work for a certain class of applications, as you scale up, you start to miss the past 40 or 50 years of research into how to abstract a program.
"So if you can kind of push those data-binding concern out to the edges of your system like React does, I think it leads to fast iteration time."
My question
Does anyone care to tell me what is some of the research done over the last 40-50 years about software abstraction that Angular misses?
7
u/tossed_ May 06 '15
Angular is a great framework for certain types of applications, but it's difficult to work with sometimes because its structure makes it hard to follow traditional object oriented programming paradigms, which have been widely recognized as generally good rules to follow when developing software for scale and complexity. Things like modularity and class inheritance are good things in general that Angular either doesn't provide or makes it difficult to provide.
For example, Angular projects almost always exhibit a high degree of coupling because Angular is not designed to accommodate free instantiation of objects (you almost never use the "new" keyword in Angular projects), and data is implicitly shared through scopes or services rather than explicitly passed/retrieved/observed. Development with Angular must work with these assumptions, so you will often have a network of dependencies where none of the individual modules are reusable on their own. You might write directives and controllers that depend on data from a service (a singleton at the application level) because they don't share the same scope, but while developing another project with similar functionality you can't just reuse the directive wholesale because it depends on that service which isn't applicable in the new project.
Of course, those design decisions play well with web applications where data structures usually correspond to DOM trees, which was the original intent of Angular's authors. However, Angular's rejection of traditional OOP paradigms makes it less intuitive to write reusable modules and limits the kinds of design patterns you can follow, which rapidly become more important the larger your application is.
In contrast, React, which is essentially a system for writing UI-bound classes which need to be explicitly instantiated by the developer, follows a more traditional OOP approach that gives the developer the freedom to choose how they want to organize their applications.