Re:Is there any code in Firefox (as of 2020) that comes from...
by saagarjha on Saturday March 28, 2020 @03:02AM
(#22709701)
> Even if it is true that code is read many times more than it is written, isn't that an argument for writing shorter, more dense code, so there's less of it to read?
This sounds like the rationale behind the APLs.
Re:Is there any code in Firefox (as of 2020) that comes from...
by rovr138 on Saturday March 28, 2020 @12:17AM
(#22709189)
> How do you know anyone has ever read that code? Surely they read the lines they changed - that's where the problems were
Of course. To fix an issue on a line, you need to know the context it’s used on and what happens with the line before and after. You also know what calls it or under what context.
> did they necessarily read the lines they left alone?
We can’t say for all of them, but they must have read lines that directly interact with it.
Even if it is true that code is read many times more than it is written, isn't that an argument for writing shorter, more dense code, so there's less of it to read? And an argument for more clever code so it's more interesting to read? If you're going to spend the next six months reading, that doesn't make you want all books to turn into Spot the Dog, does it? To the contrary the more you do something, the better you get at doing it; reading more code is often suggested as a way to make yourself better at programming. In fact, isn't it equally an argument for "if people have to read the code, there aren't enough comments, and/or there wasn't enough code verification"?
Comments are for people to read, code is for computers to execute. The refrain "code is for people to read and only incidentally for machines to execute" is like saying "engines are for people to watch and only incidentally to move vehicles" - it would lead to engines made of perspex, taking up the size of a room so there's plenty of open spaces to stick your head in for a look around, interrupting the combustion cycles for cleaning and washing cycles, moving at 10 rpm so it's not too fast to see...