All the reasons for choosing react js that you didn't know about - Avi Marcus, Wix

20
ReactJS & O(DevTime) Thoughts about frameworks and dev velocity

Transcript of All the reasons for choosing react js that you didn't know about - Avi Marcus, Wix

Page 1: All the reasons for choosing react js that you didn't know about - Avi Marcus, Wix

ReactJS &O(DevTime)

Thoughts about frameworks and dev velocity

Page 2: All the reasons for choosing react js that you didn't know about - Avi Marcus, Wix

Avi Marcus

Making the jobs of the 40 other developers in the group as easy as possible.

Page 3: All the reasons for choosing react js that you didn't know about - Avi Marcus, Wix

UI Library, just the V of MVCTiny APIDoes only one thing, does it wellOne way data flow

ReactJS - few important notes

Page 4: All the reasons for choosing react js that you didn't know about - Avi Marcus, Wix

The obvious reasons you’ve heard aboutPerformance (browsers love single pass DOM writes)Server side rendering

Why we chose ReactJS

Page 5: All the reasons for choosing react js that you didn't know about - Avi Marcus, Wix

Why everyone was so easily convinced

Page 6: All the reasons for choosing react js that you didn't know about - Avi Marcus, Wix

What convinced meOld codebase ReactJS Wix-Viewer

Time 60 years 10 years

Lines of code 175,000 46,000

Time to first productive commit of new member

2-3 weeks 1 day

Page 7: All the reasons for choosing react js that you didn't know about - Avi Marcus, Wix

Definition O(DevTime)The 1st feature is always easyHow easy is 100th???

The real reason O(DevTime)

Page 8: All the reasons for choosing react js that you didn't know about - Avi Marcus, Wix

Enemies of O(DevTime):● Poor test coverage● Complex flows● State● Leaky abstractions

What makes our jobs difficult

Page 9: All the reasons for choosing react js that you didn't know about - Avi Marcus, Wix

Poor test coverage

Page 10: All the reasons for choosing react js that you didn't know about - Avi Marcus, Wix

ReactJS - Testing

Built in support for testing the UI.Pushes you to keep the UI and the logic separate, and testing the separate logic is really a breeze.

Page 11: All the reasons for choosing react js that you didn't know about - Avi Marcus, Wix

Complex flows O(NLog(N))

Simple flows Complex flows

Page 12: All the reasons for choosing react js that you didn't know about - Avi Marcus, Wix

ReactJS - Flow is unidirectional

Page 13: All the reasons for choosing react js that you didn't know about - Avi Marcus, Wix

State O(N2)

Page 14: All the reasons for choosing react js that you didn't know about - Avi Marcus, Wix

Render is a pure one way function from props/state to virtual DOM.ReactJS will make the minimal changes in the DOM required to bring the current state of the DOM to match the returned virtual DOM.

ReactJS - Rendering is functional

Page 15: All the reasons for choosing react js that you didn't know about - Avi Marcus, Wix

Leaky abstractions 2N

Page 16: All the reasons for choosing react js that you didn't know about - Avi Marcus, Wix

ReactJS - Non-leaky abstractions

Zero lines of ReactJS read/debugged so farTrustworthy, does what you expect, no gotchasSimpleNo real DOM in sight while rendering. It doesn’t even exist in the first render

Page 17: All the reasons for choosing react js that you didn't know about - Avi Marcus, Wix

Abstraction built for Wix-Editor

Developed a touch of AngularJS envy, invented react-templatesAngular inspired html templates for ReactJS supports repeat/if/scope/class and lambda events. Generates code, that renders the view described in the HTML programmatically.

Page 18: All the reasons for choosing react js that you didn't know about - Avi Marcus, Wix

Mandatory XKCD style graph

Page 19: All the reasons for choosing react js that you didn't know about - Avi Marcus, Wix

Keeping our job easy - O(DevTime)

We have cognitive limitsHow much of what is happening in the code we can safely ignoreThe stuff we can’t ignore accumulates and eventually progress stalls

Page 20: All the reasons for choosing react js that you didn't know about - Avi Marcus, Wix

Ignorance Driven Development

“If you can stop thinking about it, and it won’t come back to bite you in the ass, you made the right choice.”

# ReactJS is awesome.