3 ms·
I 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
by acemarke 10y ago
I 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.