Skip to content

On deprecation

Deprecation

There are loads of mechanisms that can be use to deprecate something (functions, classes, modules...). And they allow devs to avoid use or be warn if using deprecated stuff.
But we need to identify clearly what we want to do.

In OTB

Today in OTB as deprecation mechanism we have :

  • vcl_deprecated header (ITK)
  • doxygen tag
  • application group

Since !236 (merged) we can deprecate a whole module. Once the latter is deprecated, one has to make sure that no other module is depending on it, otherwise it will not appear in the module tree (if OTB_USE_DEPRECATED is off), one can put the deprecated module as an optional dependency to other.

But we cannot deprecate a class without using an #if one the whole .h (otherwise it produces a warning with the _DEPRECATED_EXPORT macro`

For a better OTB

CMake offer the possibility to add export with the [[deprecated]] attribute in order to warn developer that are using it. (see !236 (merged)). But that is not enough as there is no option to allow or not the compilation of deprecated stuff.

Among different options we can use there are :

  • a deprecated module with submodule (ITK) combined with the OTB_USE_DEPRECATED flag
  • the use of CMake _DEPRECATED_EXPORT combined with the OTB_USE_DEPRECATED flag to build or not the deprecated stuff
  • ...

Feel free to propose ideas, but do not forget that deprecation can be applied to classes (when template they are quiet hard to exclude from the build), modules, namespaces, and functions. So several mechanisms can be combined to cover all those specs.

This will allow the wiki page to be updated :

  • How to deprecate a c++ class
  • How to deprecate a c++ method
  • How to deprecate an application
  • How to deprecate an OTB module
  • How to disable deprecated feature
Edited by Tristan Laurent