You get a bonus - 1 coin for daily activity. Now you have 1 coin

Deprecation in Programming

Lecture



Deprecation (from English deprecation, literally «disapproval», a declaration that a feature is discouraged or obsolete) — in programming, an indication that the use of some part of a program, procedure, or programming language is undesirable. Most often, some means of indication that is standard for the given programming language or code documentation system is used, for example a service label (tag), a special language construct, and so on. Among developers of computer programs and documentation, the term deprecation may denote a particular stage in the software life cycle, the replacement of obsolete parts with new ones.

A part of a program or a method marked as deprecated is questionable, and its further use is unjustified. This part works in the current version of the software, but may trigger an error message as a warning. This serves to warn the user that the given part of the code may be removed in future releases of the program.

The main reason for declaring a part of the code (functions, methods, classes) as deprecated is the desire to improve the code and, at the same time, to gradually get rid of outdated approaches over time. Leaving old code alongside new code would lead to unjustified bloat of the software product, which would complicate its maintenance, study, and use. At the same time, simply removing obsolete parts of the code is undesirable, since it would break backward compatibility for users of the given software.

When code is marked as deprecated, a recommended replacement is usually indicated, for example a new component with a different programming interface, but essentially with the same functionality. Sometimes, however, a part of the code is declared deprecated without any replacement. This usually happens when bugs are discovered that are fundamentally unfixable while keeping the approach that was used.

When parts of a program depend on a part marked as deprecated, the programmer should rewrite the code to eliminate the use of the part scheduled for removal. It is also recommended to rewrite the code of existing programs, especially if they already depend on the version in which the functionality recommended as a replacement appeared.

Examples

In the Java language, two notations for this tag are used:

  • The @Deprecated annotation — the compiler will mandatorily issue a warning about the use of an undesirable element.
  • The Javadoc tag @deprecated — to note this in the documentation. Sun compilers also issue a warning (although the standard does not require doing so).

In phpDocumentor, two descriptors are used, which are synonyms :

  • @deprecated
  • @deprec

In Delphi, the keyword deprecated; is used

In C++14, the attribute [[deprecated]] is used

Although a deprecated software feature remains in the software, its use may trigger warning messages recommending alternative methods. A «Deprecated» status may also indicate that the feature will be removed in the future. Features are discouraged from use rather than removed immediately, in order to ensure backward compatibility and give programmers time to bring the affected code into conformance with the new standard.

Among the most common reasons for discontinuing support, the following can be highlighted:

  • This feature has been replaced by a more powerful alternative feature. For example, the Linux kernel contains two modules for communicating with Windows networks: smbfs and cifs. The latter provides better security, supports more protocol features, and integrates better with the rest of the kernel. Since the inclusion of cifs, smbfs is deprecated.
  • This feature contains a design flaw, often a security flaw, and therefore should be avoided, but existing code depends on it. The simple standard C function gets() is an example, because using this function can cause a buffer overflow in the program that uses it. The Java API methods Thread.stop, .suspend, and .resume are additional examples.
  • This feature is considered extraneous and will be removed in the future in order to simplify the system as a whole. Early versions of the HTML web markup language included the FONT element, allowing page designers to specify the font in which text should be displayed. With the release of Cascading Style Sheets and HTML 4.0, this FONT element became superfluous and lost the advantages associated with structural markup in HTML and graphical formatting in CSS. Thus, this FONT element was deprecated in the Transitional HTML 4.0 standard and excluded in the Strict variant.
  • A future version of the software will introduce major structural changes that make it impossible (or impractical) to support old features. For example, when Apple Inc. planned the transition from Mac OS 9 to Mac OS X, it created a subset of the old system's API that would support most programs with minor changes: the Carbon library (which has since been deprecated), available in both Mac OS 9 and Mac OS X. Programmers who at the time mainly used Mac OS 9 could ensure that their programs would run in Mac OS X natively by using only API features supported in Carbon. Other Mac OS 9 features were declared obsolete and were never natively supported in Mac OS X.
  • Standardization or increased consistency in naming. Projects that are developed over long periods of time or by several people or groups may contain inconsistencies in the naming of various elements. This can be the result of a lack of foresight, changes in nomenclature over time, or personal, regional, or educational differences in terminology. Since simply renaming an element would break backward compatibility, the existing name must be left in place. The original name will most likely remain indefinitely, but will be excluded in order to encourage the use of the new, more consistent naming convention. An example is an API that alternately used the spellings «color» and «colour». Standardization would result in the use of only one of the regional spellings everywhere, and all occurrences of the other spelling would be deprecated.
  • A feature that was previously available only independently is now combined with its complementary feature. An example is VLC Media Player; VLC used to stand for «VideoLan Client», and a separate «VideoLan Server» was available as its companion feature. Both the client and the server became available in a single package, so obtaining one independently of the other would be impractical.

Other uses

An example in hardware design is the absence of pull-up resistors on unused inputs of a logic element. This practice may have been acceptable in the past, but became obsolete, since higher clock frequencies can cause more transient noise on input lines, causing hardware faults or failures.

A building code example is the use of ungrounded («2-prong») electrical outlets. Over time, these old devices were abandoned in favor of safer grounded («3-prong») outlets. Older, ungrounded outlets were still permitted in many places by «grandfathering» them into existing wiring, but prohibiting them for new installations. Thus, although ungrounded outlets may still be available for legal purchase in a place where they are deprecated, they are generally intended only for repairing existing old electrical installations.

In writing and editing, the use of a word may be inadmissible because it is ambiguous, confusing, or offensive to some readers. For example, the words sanction and inflammable may be misinterpreted because they have auto-antonymic or contradictory meanings; writing style guides often recommend replacing them with other words that are clearly understood and unambiguous. Some uses of words that have acquired different connotations over time, such as «gay» or «colored», may be recognized as deprecated in formal writing.

In technical standards, the use of a particular clause may be disapproved or replaced by new clauses. For example, in the Ethernet standard IEEE 802.3-2012, clause 5 (Layer Management) is "deprecated" by clause 30 (Management), with the exception of clause 5.2.4.

The term obsolete may also be used when a technical term becomes obsolete as a result of change or replacement. An example from paleontology is the formerly obsolete term «brontosaurus»; before it was re-recognized as a unique genus, it was considered a popular but obsolete name for the genus Apatosaurus. Some examples of obsolete terms from medicine include consumption (tuberculosis), the grippe (influenza), and apoplexy (stroke). In the field of chemistry, the international standardization organization IUPAC (International Union of Pure and Applied Chemistry) abandoned the term «methyl ethyl ketone» and now recommends using the term «ethyl methyl ketone» instead.

See also

  • Planned obsolescence
  • Orphaned technology
  • Software
  • [[b8565]]
  • [[b9167]]
  • Binary compatibility
  • Bug compatibility, backward compatibility with known defects
  • Compatibility mode
  • Computer compatibility
  • Obsolescence
  • Downgrade attack
  • Emulator
  • Flag day (computing)
  • Legacy mode
  • Shim (computing)
  • Software regression
  • Vendor lock-in

See also

created: 2021-06-15
updated: 2026-03-10
170



Was this answer useful?
Choose a quick rating so we can improve the next answer for you.
How satisfied are you?


Comments

To leave a comment

If you have any suggestion, idea, thanks or comment, feel free to write. We really value feedback and are glad to hear your opinion.
To reply

Lectures and tutorial on "Software and information systems development"

Terms: Software and information systems development