3 ms·
but pageCountDisplayed = pageCount + 1 is more useful still.
by lozenge 7y ago
but pageCountDisplayed = pageCount + 1 is more useful still.
- hnlmorg 7y agoIn that specific case, potentially - bare in mind it's imaginary code you're refactoring. There will be occasions when "ugly" code is required. The point of my post, which I suspect you missed, is that comments will generally be more useful if they describe the purpose of that code (which is harder to deduce) rather than what that code does (which often can be easily deduced just be reading the code).
- lozenge 7y agoThe point of my post is that code will be more useful if it describes the purpose of that code. Sure, for the rest of the time there's comments.
- hnlmorg 7y agoYes, I got that. As I said: > In that specific case, potentially - bare in mind it's imaginary code you're refactoring. There will be occasions when "ugly" code is required. ie, I don't disagree with your point however it's not always possible to refactor code for readability. Plus you're still missing the point that writing better comments can give you additional information ("why does it do it") that you might not gleam even from even well written code ("what does it do").