Two parts to this answer
The fact that he made this comment openly on someone's question is fairly rude and sets the wrong tone for the site. I don't condone it.
The practice of not answering questions of poor quality, is a valid one; but we don't have to flaunt it by telling people, passive-aggressively, that their questions are bad quality.
Regarding the second point: if a question is a poor fit for the site but is well-written and shows research effort, I'll either invite them to chat, or help them in comments. If it's a REALLY good question that for some reason is going to get closed, I'll attempt to edit the question to be less terrible, in an effort to salvage it so it won't get closed, and then answer it properly.
The absolute worst thing I do to a question / questioner is vote to close and/or downvote. I consider it helpful and courteous to provide a comment explaining -- nicely -- why I casted these votes, but I don't always do it, unfortunately :( That said, posting comments which don't help the user and just serve to discourage them, is bad. Unless the question is blatant spam and will be deleted in mere seconds, in which case, I occasionally pop a joke before the question gets nuked and the user account kersploded. But that's rare.
I always try to judge the intentions of the user, as well as how much research effort they put in. If I find that their intentions are pure and they genuinely are trying to learn something or figure out a problem, I will try to help them any way I can, and be courteous to them, even if it results in a back-and-forth over comments, or severe question editing, or politely voting to close. If their intentions are to be lazy and get someone else to do their thinking for them, I generally won't say anything to them.
If you can't say anything nice, don't say anything at all.
I don't think I need to provide a source for this quote, but it has meaning even in the 21st century on a new-fangled Q&A site.