4 ms·
This post does a great job refuting minor points while completely ignoring the central arguments of the original.[1][2] The React TodoMVC weighs some 451 lines
by beefman 10y ago
This post does a great job refuting minor points while completely ignoring the central arguments of the original.[1][2] The React TodoMVC weighs some 451 lines -- more than vanilla JS, jQuery, and over twice as much as Vue.
There are weird incentives in software ecosystems. Companies benefit by controlling one because they can hire easily, and ensure their code & tools will not become obsolete. And the more complex ecosystems become, the harder it is for devs to compare them or switch. I think there were similar forces at work in the UIs of large GUI applications like DAWs. Once you get through the painful learning process, you find you love it, and find it impossible to switch -- a phenomenon that has attracted comparisons to Stockholm syndrome.
[1] https://gist.github.com/GianlucaGuarini/b9238a187ef13897b71e15e4906e4499 https://gist.github.com/GianlucaGuarini/b9238a187ef13897b71e...
[2] https://news.ycombinator.com/item?id=14184666 https://news.ycombinator.com/item?id=14184666
- oblio 10y agoIt's a trade off. At least we also get access to their internal frameworks, unlike in the old days.
- acemarke 10y agoReact's benefits come through more at scale. If you just want to add a bit of interactivity to a page, sure, jQuery is going to be fewer LOC and KB. If you're trying to write a large full-blown application that's 10K, 50K, 100K LOC, with tons of views and lots of data to manage, jQuery won't cut it. React helps you build the UI in manageable, understandable, reusable pieces.
- davidjnelson 10y agoExactly, which also helps with maintenance and testing.
- beefman 10y agoA valid point, but TodoMVC is enough of an app that I feel we shouldn't be multiplying jQuery by 2. No larger benchmarks exist, but I'm reasonably confident React would still be substantially larger than e.g. Riot, Vue, or Svelte. And yes, conventions have value, but it's a zero-sum kind of value that comes at the expense of all other possible conventions.
- danabramov 10y agoAlthough it's nice to express things concisely, we don't think size in raw lines of code is the most important metric in the code. Generally we are interested in solutions that allow us to iterate quickly, and to ship less buggy apps, and React has been helping out with this. I don't have experience with Vue, but I also heard great things about it, so I'm glad there are many alternatives if React doesn't work well for you!
- beefman 10y ago> we don't think size in raw lines of code is the most important metric in the code I've read this claim from FB before (Pete Hunt I think). It's not possible to overstate my disagreement. I guess if you want to say, 'people in general can't program, but they can plumb things together, and once they learn the conventions the boilerplate becomes transparent', I wouldn't argue. But you haven't said it, and it's not a direction I think is so great for software. In the future we want one-line applications, right? "Siri, create a calendar app with conflict resolution for the local Owl's club." Not four pages of "Siri, open angle-bracket props colon..."[1] Re. Vue, I'm sorry I mentioned it. I don't have a horse in the race. However if I did I would definitely have taken the time to try Vue by now. And likewise Guarini, if this is really his first time trying React, has not done basic due diligence by waiting this long. We can't improve as a field unless we compare results. That TodoMVC is the only benchmark that even exists is unfortunate. [1] For some evidence in the meantime see http://blog.vivekhaldar.com/post/10669678292/size-is-the-best-predictor-of-code-quality http://blog.vivekhaldar.com/post/10669678292/size-is-the-bes...
- acemarke 10y agoI think the point is that LOC is a bad metric in general. In the same way that you wouldn't want to measure a dev's output by LOC/day, just comparing LOC for a small task isn't really meaningful. That approach can be heavily gamed (see code golfing), and there's the apples/oranges aspect as well. jQuery is meant for manipulating arbitrary DOM nodes in a page. Assuming they share a classname, I can hide a dozen divs scattered throughout the page with a single `$(".myClass").hide()`. In React, I'd probably need to pass some state through several components, and ultimately re-render, which would be considerably more LOC. Does that mean that React is "worse"? No. It means they're meant for different kinds of tasks. React is meant for making codebases maintainable and understandable. Sure, fewer LOC is _usually_ a good thing, but many times being more explicit makes a codebase more maintainable.