Hope this is on-topic, seems meta-ish.
I would like to address the issue of mysql_*
functions; for the sane many of you who don't bone up on your PHP doctrine, a little back story. The notorious mysql_*
family of functions are related to database access and are set to be deprecated in the near future. The official documentation lists them as "discouraged", and recommends using PDO. The party line is to SHUN.
In a wider context, this sort of situation may exist for other tags, and it boils down to the same thing.
Currently, many seasoned users crusade against these mysql_*
functions, leaving copy/paste comments on every question even remotely referring to these database pariahs and directing users to read articles advocating and demonstrating PDO. Others work it into their answer. To these programmers, I can only say "thanks" -- every new tutorial or Q/A on the internet that uses the most up-to-date practices helps wash out the mountain of outdated code using the doomed old functions.
But. If you look at the last question there, you note that though the answerer did disclaimer against mysql_*
, they used the deprecated method in sample code to form their answer. The disclaimer is meaningless, but the answer can be defended by saying "I told them about the right way, then showed them the wrong way", or "the answer is based on THEIR code". Perfectly true. I compare this to stopping someone from driving a nail with a glass bottle. You tell how great hammers are and that they are the tool for the job (without actually producing one for inspection). But then you come back, like Colombo, and remember to mention that one could wrap a towel around the glass, preventing a horrible cut when the bottle breaks. You then hand them a towel.
The first point of this post is to put forward a premise: as a Q/A site, StackOverflow exerts a major influence over the adoption of one particular practice or another by the content of answers. Answers here today are Google search results for next month's rank greenhorn. The second point here is the idea that, given the former, we must be more proactive in advocating best practice in the content of all our answers.
Every php/mysql_*
question that is posted (and there are several hundred posted a day) have the potential to encourage or discourage best practice. Is it appropriate to downvote an answer for simply referring to mysql_*
(except, of course, to discourage it)? Delete the answer? Seems extreme, but I feel we have a role to live up to -- this is what separates the StackOverflows from the w3Schools and bottles from hammers.
Hammers, hammers for everyone, I say!
Agree? Fine -- how? Disagree? Why?
mysqli_*
which is a recommendation... am I missing something?