One of the last projects I worked on had a lot of deprecated methods. Are there any good strategies for making sure that the use of these methods actually decreases over time? The example below is Python-specific, but this question really applies to all languages.
I've read a little bit in the past about adopting informal policies that apply to every commit such as "number of lines not covered by the test suite is not allowed to grow" or "coverage percentage must not decrease" as a means of improving test coverage that doesn't involve dropping everything. That's also sort of the angle that I'm approaching this from. What's a measurable criterion that someone can look at to determine whether their commit is polite or not.
Here's what an example might look like. Suppose I have a
RequestTask that used to have a
group_id, but doesn't anymore. The
validate_group_id method is now deprecated and just calls
group_id instance variable has been replaced with a property. Here's a skeleton file.
class RequestTask: ... def validate_request_id(self): ... # deprecated method def validate_group_id(self): return self.validate_request_id() @property def group_id(self): return None
Let's further suppose that we can't just change all the code that calls the deprecated methods right now, due to time constraints.
I want to make sure that code calling these deprecated methods eventually gets changed.
- What are some good strategies for tracking whether use of deprecated methods and APIs is actually decreasing over time?
- If necessary, what's a good way to enforce a policy that WILL lead to non-use of deprecated methods?
- Is it even a good idea to attempt something like this?