11

A lot of the time when people ask questions, their example code has unrelated issues in it which I feel a moral obligation to tell them about.

A good example of this is when someone asks why an SQL query is not working, yet unrelated to why it's not working is a huge injection vulnerability. It happens so frequently I sometimes wonder why the site isn't named SQL Injection Overflow.

So I guess the long and short of it is, should you suggest things that are unrelated to their core issue which might possibly confuse them?

1

1 Answer 1

10

You should try to answer people's question exactly as asked first, even if you think there are unrelated issues they should know about, or even if you think their entire approach to the problem is wrong, or even if you think they are looking for a solution to the wrong problem.

But it would be doing them and the community a disservice to end it there. It's always helpful, after answering the actual question, to bring up any issues that may be relevant (this is especially true if you believe what they are doing is a security risk or otherwise dangerous). They may find it useful. And if they don't, no harm done. And since this is a resource for everyone, someone on the internet may find your additional advice useful.

Just remember that it's important to be polite and diplomatic when doing this, because you don't want to offend someone or sound condescending/patronizing. This is not hard to do as long as you pay attention to your wording.

As examples, I've selected a few of my answers where I've added additional information at the end. I'm sure there are better examples from other people (if I dug enough I could probably find better examples from myself as well), but this should suffice to illustrate:

  • Where and how to assign a user :admin role for attr_accessible in rails 3.1? -- I could have just posted some quick code for the OP, but they clearly had some trouble understanding the concepts here so I elaborated and explained the whole system (and they were very appreciative).
  • Padding table with CSS doesn't work on IE -- I added a note about avoiding inline styles at the end. Even though the OP was aware of this already (and only used inline styles for demo purposes), they didn't mind my extra note.
  • Javascript function not returning value -- Here there was an empty try/catch block that served no purpose in their original code, but also was pretty unrelated to their problem. I still explained the problems with this at the end, and again despite the fact the OP was already aware of this, they didn't mind I elaborated on it and were appreciative for my answer.

And finally, here's an example where I just gave the solution and didn't mention a thing about the many larger problems with their code. Someone else came by and did elaborate, and despite the fact that they did it in an extremely rude and abrasive manner, the end result was still a -1 score on my answer and +5 score and checkmark on their answer:

Just goes to show that even when the "be polite" guideline is severely violated, the OP and community at large can still appreciate the extra depth.

1
  • 1
    This makes sense, it's the answer I was hoping for! Thanks for that.
    – calcinai
    Commented Sep 18, 2013 at 3:01

Not the answer you're looking for? Browse other questions tagged .