3 ms·
I appreciated the minification walk-through more than actually having a tweet solid package manager. Before you get to the range of code golf, less code means l
by bigethan 11y ago
I appreciated the minification walk-through more than actually having a tweet solid package manager. Before you get to the range of code golf, less code means less bugs.
- louhike 11y ago"less code means less bugs" That really depends on how you make less code. Transforming an if condition in a ternary operator could make the code much harder maintain, therefore bring more bugs. This is one example from several cases. Sometimes a longer code means a code more readable.
- k__ 11y agoReally? I like the ternary operator more than if, but only because if is a statement in JavaScript.
- 91bananas 11y agohttps://github.com/mbostock/d3/blob/master/src/selection/html.js https://github.com/mbostock/d3/blob/master/src/selection/htm... I had to look this over the other day, I found it nearly unreadable.
- Stratoscope 11y agoThe problem with that code is partly the overuse of the ternary operator, but even more it's the wildly inappropriate code formatting and structure. Code that looks like this would be a WTF no matter what operators or statements it uses. Judicious, simple, and straightforward use of the ternary operator looks nothing like that.
- 91bananas 11y agoThe craziest part to me is if you look at the history of that file, that is the ONLY commit on that file ever. How does one write that the first time, and never have to touch it again!?
- neogodless 11y agoI think you can likely argue writing less code means creating fewer bugs. But there are a billion counterexamples where more code accounts for more conditions, and thus means less remaining bugs. This is a great read on why that's the case: http://www.joelonsoftware.com/articles/fog0000000069.html http://www.joelonsoftware.com/articles/fog0000000069.html