-8

Sometimes I come across questions and/or answers under the PHP tag (I'm sure the problem persists for other tags as well) that use deprecated functions. While some of this might be a result of new users (admittedly like myself) using outdated tutorials, etc., many are deprecated because they were asked/answered when the function was not deprecated. On these questions it seems less likely that a user will comment to point out that a function is deprecated.

I propose that StackOverflow display a warning above each of these questions/answers to notify the user that the function used is deprecated. Something like this:

The split() function is official deprecated as of PHP 5.3.x. You should use preg_split() instead to ensure functionality.

Or, even simpler:

This question or answer may contain deprecated functions. Proceed with caution.

This could be instituted either via users flagging deprecated questions/answers. I'm not sure if it is possible, but it could also be instituted automatically by crawling questions and answers.

An admitted downside is that the user may just leave the page and not read on to see if there are any non-deprecated answers. But that's probably better than the user using the deprecated code, right? Also, many new users like myself often do not know which functions are deprecated. In those situations, I know I would appreciate knowing that an answer might be outdated.

  • 3
    I assume their IDE will tell them it is depreciated with far greater reliability – Richard Tingle Nov 9 '13 at 21:46
  • 3
    How many languages Stack Exchange deals with? That's a compiling nightmare, no? Somewhat related. – brasofilo Nov 9 '13 at 21:50
7

One of the most important features on the Stack Exchange platform is the editing features. Any user can suggest an edit to improve a Stack Overflow post, and users with 2000 reputation or higher have full editing rights to edit any post in the system.

As a result, such deprecation warnings can be added as either suggested edits or full edits.

However, I'm not entirely sure how useful this would really be. There is a lot of content on Stack Overflow, and the information constantly changes. It would entail quite a lot of work to continuously review every answer to look for deprecated functions. The addition of such messages in some areas may inadvertently lower the guard of the readers to where they assume no deprecation notice means all is good.

Instead, users shouldn't look at Stack Overflow as a replacement for the documentation. Instead, look to Stack Overflow to find the answer to a problem, and then use the documentation to dig even deeper to gain a much broader understanding of the topic from the official source. Hope this helps!

You must log in to answer this question.

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