3

This question Table 'watchdog' was not locked with LOCK TABLES on custom module has some good answers, but the top voted answer and comments as well as being a valid answer veer into coding standards comments.

While I support encouraging coding standards I worry that when people post code, the answers will tend towards pointing out standards errors in the code rather than answering the question. This could lead to people being reluctant to post code and questions.

What should we do about this? I think the focus should be on answering the question, with comments about the code in the comments section of the question, and perhaps limited to more serious (security) comments.

| |
3

The first purpose of an answer is to answer the question being asked; anything not directly required from the question is a side note, and it could better suit a comment.

I agree; if all the answers would report what in the code written in the question doesn't follow the coding standards used for Drupal code, that would make Drupal Answers less interesting for the users. If the question is about how to write secure code, or code compatible with other modules (or Drupal), then reporting that would be acceptable.

There are other things that I think should be avoided, as ending an answer with "Why don't you use X instead of Y?" The user has probably his reasons to use module Y, and I don't think he should explain which those reasons are on any questions he asks about module Y.

| |
  • Fortunately, we don't have yet any problem with answers that report what is wrong in the shown code, except for what is relevant for the question itself. – kiamlaluno Apr 28 '11 at 22:43
3

You answer is the accepted one, by the way. :)

Also, my answer (the comments not so much, but that's still important information imho) is about a security issue and using the API function would also resolve the issue of the read vs. write lock. :)

But in general I agree, coding style issues should be posted as comments instead.

| |
  • Yours was a good answer and it was a good point about using placeholders in the query. I'm more worried about code style zealots putting people off. I know it has happened on D.org. – Jeremy French Apr 28 '11 at 9:45

You must log in to answer this question.

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