Topic on Talk:Deprecation policy

How does this policy affect unused code?

2
X-Savitar (talkcontribs)

I've seen people ask about this and I've also encountered it myself. How does this policy address unused code? Like code that was introduced but never used ranging from variables, constants, classes, etc. Maybe it's worth mentioning in the policy how this should be treated?


References (from #mediawiki-core):

22:55 (dmaza) do we have a policy about removing un-used code? Does it have to be soft deprecated/hard deprecated or can it be straight up removed from the code base?
Krinkle (talkcontribs)

The policy does not mention unused code, because it is not treated differently.

All public interfaces to the MediaWiki core PHP code that was released, must follow the deprecation policy prior to removal.

Local variables are not public, and do not follow the deprecation policy as such.

There is no exemption for "unused code". There are multiple reasons for this, but for me the main one is that we can't really know whether something is unused.

Wikimedia Foundation has all its code public in our Gerrit, and with pretty good search. Although even with that search, we've definitely missed things in the past. It's not perfect. It's always better to deprecate first and allow ourselves to find warnings from production.

Apart from WMF, it's important to remember that MediaWiki is an open-source project used for many other websites. One would need to know every website in the world and every possible way to publish source code relating to MediaWiki, and search it. One would also need to know which version of all those projects are currently in deployment or not. This isn't realistic.

Besides public code, there is also site configuration which is usually not made public (Wikipedia represents the exception there, not the norm).