4 ms·
Yes, this part of the article seems like nonsense to me. If it didn't have a question mark, we would need a comment? But because the predicate name contains a q
by chihuahua 3y ago
Yes, this part of the article seems like nonsense to me. If it didn't have a question mark, we would need a comment? But because the predicate name contains a question mark, that's the only reason why we don't need a comment? That's nonsense.
This only makes sense if we're in the school of thought that writes
i = i + 1 // increment i by one
- woodruffw 3y agoThis is an uncharitable reading; I don't think the author is literally saying that predicate-style methods are a perfect replacement for comments. The more charitable interpretation is that they're pointing out the developer ergonomics of things like predicate methods remove the need for comments that might otherwise be reasonable to insert. Whether or not that is true is subject to reasonable debate, but it's definitely a more nuanced opinion than "Ruby's predicate idiom means I don't have to document my obvious code."