r/javascript • u/iamakulov • Sep 27 '17
How React team rewrote React 16 from scratch keeping the same API and stability
https://code.facebook.com/posts/1716776591680069/react-16-a-look-inside-an-api-compatible-rewrite-of-our-frontend-ui-library/120
Sep 28 '17
In other news:
How Angular team rewrote Angular from scratch breaking absolutely everything
Kidding aside, it helps to have a small surface, focused, single purpose API which the React team wisely kept to (in fact they reduced the surface of the API as they gradually removed unnecessary elements like class emulations, as ES6 classes became available).
I can't wait for people to finally learn this lesson, so the age of the "overreaching huge monolithic framework" is over.
51
u/Existential_Owl Web Developer Sep 28 '17
The fact that FB heavily dogfoods their own software, I think, plays into this.
When you actually get to suffer the pain caused by your own mistakes, it really puts things in a different light.
29
Sep 28 '17
Supposedly Google also use Angular a lot. Although they use Angular 1.x, they use Angular 2+, and they use Angular Dart which is now an entirely independent fork, and they use also like a dozen or so other frameworks for JS UI.
It's hard to tell how important Angular is for Google, because "Google uses it" may mean 3 out of 4000 teams use it (BTW, yes, Google is that big).
47
u/Baryn Sep 28 '17
Google doing something hasn't been an indicator of quality in a long time...
16
u/davidstepo Sep 28 '17
100% agreed. Sometimes, it seems that they're doing something just for the sake of it, just to look superbly busy to the public.
0
Sep 28 '17
[deleted]
4
u/Baryn Sep 28 '17
You release things that are successful or you get out.
Who is “you” in this case? Almost every dev I have known from Google has either not been on a product-releasing team at all or is the code monkiest of code monkeys.
3
u/Patman128 Sep 28 '17
You release things that are successful or you get out.
Unless you're part of Google+ apparently.
3
u/sjwking Sep 28 '17
I don't know which framework Google uses for the new YouTube, but it's slow as hell. Every fucking thing is a component. Who in their right mind chose this approach? Everything they are doing could have been implemented with vanilla js and I bet it would be a magnitude faster. It reminds me a story about one developer that after graduating from college went to develop a large project with php but choose the oop way. But php sucked so bad at the time that he was forced to completely rewrite the project because php was a dynamic language and the php complier sucked at it's job. Always test if the fancy new technology you are using had bad consequences.
8
Sep 28 '17
I don't know which framework Google uses for the new YouTube, but it's slow as hell.
I think it's their Material library: https://material.io/guidelines/material-design/introduction.html
It's probably their most involved/heavy design indeed, because they're trying to emulate on the web, what they do in the Android's native UI. Something's gotta give.
Every fucking thing is a component. Who in their right mind chose this approach?
I haven't inspected it in depth, but having everything as a component seems like a good design choice (in the abstract at least). The devil's in the details, of course.
9
u/mainst Sep 28 '17
I think it's their Polymer framework. Material design is just the UI but it can be used with any framework (Angular, React etc)
4
u/kevinkace Sep 28 '17
That's their presentation lib. I believe the new YT is built with Polymer (web components)...?
0
u/sjwking Sep 28 '17
Having most of your UI as a component is fine. But there is overhead. Every single comment has different components inside. There is certainly overhead here for very little benefit.
3
2
1
u/Mael5trom Sep 28 '17
Google has Angular in use in over 1000 internal apps (mentioned at ngConf the last 2 years), all of which run the tip of Master. The Angular team actually runs not only the Angular test suite but all of the test suites for all of the internal apps as well.
-5
-23
u/DerpsMcGeeOnDowns Sep 28 '17
Stop comparing React to Angular. They aren’t the same and never will be.
Tired of this stupid shit.
29
Sep 28 '17
When the majority of JS client-side developers have to choose a platform for building their application UI, they most often choose Angular or React. Those are the two most predominant solutions by far.
In that context, they are competitors for the same job. The fact they're different in other ways is irrelevant in that context. So of course we can compare them.
Also I can drop jokes about Angular when I feel like it without your personal approval.
-13
u/DerpsMcGeeOnDowns Sep 28 '17
Well this escalated quickly. Let’s just be cool and understand the diffs.
55
Sep 28 '17
When analyzing solutions, there's an old saying I always keep in the back of my head to help me not miss the forest for the trees:
"Nobody really needs a drilling machine. They need holes in their walls."
Another way of saying the same thing:
"Don't ask how to build a bridge, ask how you can cross the river."
When the job is crossing the river, a bridge and a boat are competitors, and they will be subject to comparison. The differences were always there and always understood, but the only thing that matters in the end is the problem to be solved.
6
-40
u/tossaway12341234 Sep 28 '17
Spoken like someone who hasn’t used both in prod. Clown.
I don’t give a fuck what you wanna compare or crack jokes that aren’t jokes. Apple to oranges. I’ll just ensure people like you never make on my teams, my companies, making my type of money. And as long as you promote this naive, topical understanding of front end web tech, I’ll continue taking all your work too.
A lot of people value logic and understanding tech. You don’t and that’s cool. But if you aren’t gonna apply it, miss me with your dumb ass comments and dev wannabe opinions. Tired of posers like you out here talking stupid.
24
Sep 28 '17
Hello! This is a reminder to take your pills.
I’ll just ensure people like you never make on my teams, my companies, making my type of money.
Now here's someone taking a game of Monopoly dead-seriously.
-37
u/tossaway12341234 Sep 28 '17 edited Sep 28 '17
Or just someone who knows what they are talking about. Again, your career man. Wanna sound stupid to people that are actually in the game, your call. But understanding tech is a prerequisite for talking tech and you just sound stupid.
Or for a cliche: React !== Angular.
You wanna talk React and Vue, now you have a candle to hold.
22
Sep 28 '17
You didn't say anything of substance above, you just had a mental breakdown over me saying Angular broke B.C. when they rewrote (which is factual).
Of course, on the Internet you can have "your teams", "your companies" and "your kinds of money", but with this attitude you'd be lucky to be able to get a job at all. At least not on my tanks, my air carriers and my space-ships!
5
u/alliejay_ Sep 28 '17
Have to hand it to you... you handled this angry person very well and made me laugh a few times along the way.
-28
u/tossaway12341234 Sep 28 '17
Clearly not someone who dealt with a cutover or upgrade or understands what happened in the more general ES6 cutover with native modules and native components.
And please with the attitude. This isn’t something I’d bring into my company or my clients. It’s just something that all of us who actually leverage a variety of tech are tired of hearing in interviews with juniors and, pathetically, people that call themselves seniors. Educate yourself. I don’t like know-it-all know-nothings like you.
Fuck outta here until you can talk the tech and not some blog you read one time by some guy that hasn’t deployed shit. We are just trying to get the imposters out.
9
u/whowanna Sep 28 '17
I agree with the sentiment that the two are hard to compare. About a year ago one of the biggest banks in my country (and quite a big name world wide) approach my company for consulting. They wanted an answer for the exact question OP mentioned: should we replace our legacy Angular.js codebase with ng2 or React?
So no matter if you want to compare the two or not; enterprises and their architects do.
-9
u/tossaway12341234 Sep 28 '17 edited Sep 28 '17
Exactly my point. Why are you comparing them? Makes people sound/look like they don’t know shit.
12
u/adamcw Sep 28 '17
You’re being needlessly abrasive, but I’ll bite… It IS a choice in frontend architecture. You’re making the same mistake you’re accusing others of making in saying that it’s a distinct choice due to the differences in implementation. The choice is if you are pushing your business logic to the front (Angular) vs either a) choosing React + something to do something MVCish on the frontend(a mistake in my opinion) or b) choosing to have a lighter but more immutable data structure on the frontend and pushing the orchestration of that to the backing API layer. It’s not just a library choice, it’s an architectural choice. Which is what I am going optimistically assume you were trying to say, while lacking professionalism and manners.
-4
u/tossaway12341234 Sep 28 '17
Sure. But it’s purposeful.
I am, along with many others, sick of comparisons that aren’t and sick of stupid shit getting into our ecosystem and realms of understanding. The argument above is tantamount to “Is LeBron a better baseball player than Ruth?” What? Why? They aren’t the same. So stop talking about em as if they were.
Educate yourselves. Stop promoting stupidity.
React + other shit can attempt to get to Angular. But when people talk React vs. Angular, they are just being dumb. That’s it. Period. End of discussion.
→ More replies (0)-10
u/DerpsMcGeeOnDowns Sep 28 '17
While that may be the case, it’s up to more knowledgeable people to point out the fact they are not comparable.
9
u/whowanna Sep 28 '17
yeah but nonetheless when rewriting an app or launching a new one you have to make an architectural decision, and those are nowadays between React and Angular.
1
u/DerpsMcGeeOnDowns Sep 28 '17
And my only point is it’s a false equivalency. React and Angular solve different problems with the only similarity being that each deals with the V. People unfortunately equivocate the two because they are front end tech.
→ More replies (0)
26
8
6
Sep 28 '17
The last sentence is exciting! This is just the rewrite of the core. It’s going to be interesting see what new features we get in coming months/years.
3
5
u/leafoflegend Sep 28 '17
They did so many things right. Definitely showing to my company to have us rethink how we re-write (or even just write) larger codebases.
-128
Sep 27 '17
rewrote React 16 from scratch
Err, what?
This is newbie programmer 101 - I don't understand it so I'll just rewrite it!
Do I have an overwhelming feeling this rewrite is going to be laden with untested bugs?
61
28
12
9
u/themaincop Sep 28 '17
No, yeah, you’re definitely way smarter and a better programmer than the React team.
8
6
Sep 28 '17
Literally the entire article is about justifying how they built confidence in the rewrite.
4
u/ThePsion5 Sep 28 '17
"I don't read articles before commenting, not do I understand what unit testing is"
-3
Sep 28 '17
"I don't have anything to contribute to this discussion so I'll just personally abuse somebody"
-- /u/ThePsion5
2
24
u/ConfuciusBateman Sep 28 '17
Interesting read. But what does dogfooding mean?