3 ms·
A reasonable 'compromise' of 3 lines of code with 7 lines of comment to explain what it's doing would be my preference.
by onion2k 9y ago
A reasonable 'compromise' of 3 lines of code with 7 lines of comment to explain what it's doing would be my preference.
- throwaway2016a 9y agoOr... 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; }
- onion2k 9y agodevelopers 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.