Re:FizzleFade
by onion2k on Tuesday August 29, 2017 @09:36AM
(#15124142)
A reasonable 'compromise' of 3 lines of code with 7 lines of comment to explain what it's doing would be my preference.
[ Parent
| on HN ]
Re:FizzleFade
by throwaway2016a on Tuesday August 29, 2017 @10:12AM
(#15124377)
Or... and just throwing this out there... developers can take responsibility to know what bitwise operators do the same as they know what "+" does.
The three lines of code were:
for ( ... ) { x = x << y }
The developer was essential using an array of booleans to simulate a bitwise operator.
It is very sad that devs these days need a comment to know what that does. Would we expect 7 lines of comments if it was:
for ( ... ) { x = x + y; }
developers can take responsibility to know what bitwise operators do the same as they know what "+" does
Yes but they won't. Pragmatically speaking adding a comment to explain a concept the next developer won't use very often means you won't need to answer their questions about it when they next need to modify that piece of code. That's a big win for you, and it means the other developer can carry on being productive.