4 ms·
> “As a Lead JavaScript Engineer, I try to get my team to write as little JavaScript as possible.” I would argue that the wisdom of this goes beyond JavaScript
by smacktoward 11y ago
> “As a Lead JavaScript Engineer, I try to get my team to write as little JavaScript as possible.”
I would argue that the wisdom of this goes beyond JavaScript to all programming.
Or, to put it slightly differently: how can you tell the difference between an inexperienced programmer and an experienced one? The inexperienced programmer thinks of every line of code as an asset. The experienced one thinks of every line of code as a liability.
- vlunkr 11y agoThat's a great quote! (the last line) That's something I've experienced but hadn't really been aware of until I read that.
- brlewis 11y agoPerhaps you want this 1988 quote from Edsger W. Dijkstra: My point today is that, if we wish to count lines of code, we should not regard them as "lines produced" but as "lines spent": the current conventional wisdom is so foolish as to book that count on the wrong side of the ledger.
- talmand 11y agoI think the idea of reducing lines of code as a means of success can go too far. Sure, you can squeeze that block of code down a few dozens of lines of code, but then how hard is it to follow along behind you and deduce your intentions? You may be saving something today to just be needlessly spending it tomorrow.
- mod 11y agoIt's almost never taken too far, so generally speaking, this argument doesn't carry much weight. Also, at a few dozen lines per block, you could keep going a long way!
- talmand 11y agoThe fact that it's almost never taken too far is a good example that it actually does carry a great deal of weight, it's just one of those things that people respect.
- brlewis 11y agoYes, reduced spending in any area can go too far. There's such a thing as justifiable spending. Calling it spending merely illustrates that it isn't automatically a good thing.
- vlunkr 11y agoThis is true, I've seen one-liners in ruby that will make your eyes bleed. As I've matured as a developer I've felt the need to write less lines to code, but also to be very clear and explicit. I think there's an appropriate balance somewhere.
- xg15 11y agoI think it makes more sense if you see lines as an indicator for the thing you'll really want to minimize, which is the complexity of the model and/or instructions you describe in the lines. To use a somewhat skewed analogy, imagine you want to tell directions to a foreigner. One possible answer could be "Go 200 meters west, then go 100 meters east, then go 100 meters south". The route that this answer describes is needlessly complex. The simpler route "Go 100 meters east, then go 100 meters south" will bring you to the same destination in less time. You could try to further simplify you answer and just tell "Use the old road". But while that reads even shorter, you have not reduced the complexity of the actual route. It's just hidden behind an abstraction.
- talmand 11y agoI'm not against reducing complexity, I don't think that's necessarily going too far. I'm speaking more about what happens when you go too far and someone else has to deal with it. Let's say the simplest, and still descriptive, directions are: go down Main Street turn left at Oak Street turn right at Acorn Lane fifth house on the left versus: go that way, left at Smith's, right at Taylor's, brick house The second is an example of refactoring to reduce line count but actually increases complexity to someone not familiar with the area.
- smacktoward 11y agoI wasn't familiar with that Dijkstra quote, but yeah, it definitely gets at the same point I was getting at. My version is snappier, though! Maybe my liberal arts degree wasn't such a waste after all :-D
- T-hawk 11y agoSame idea, attributed to Bill Gates: "Measuring software by lines of code is like measuring an airplane by weight."
- akilism 11y agodouble edged sword though right? we should be striving to write the most readable and easily understandable code. neither the most lines or the fewest but what can be easily proven and reasoned about.
- marcosdumay 11y agoYes, ok. Some lines are more of a liability than others.
- deleted 11y ago[deleted]