How long to wait before deleting a deprecated method?
up vote
17
down vote
favorite
I am maintaining a public API and have to deprecate a method.
Is there a general rule on how many months/years/versions before the deletion I should deprecate a method?
java deprecate java-annotation
|
show 1 more comment
up vote
17
down vote
favorite
I am maintaining a public API and have to deprecate a method.
Is there a general rule on how many months/years/versions before the deletion I should deprecate a method?
java deprecate java-annotation
8
The general rule is "keep it around for as long as you and/or your customers need it."
– Robert Harvey
11 hours ago
6
Define "public". Free, open source software, with the usual "use at your own risk" disclaimer? Or sold software where a contract exists?
– Doc Brown
10 hours ago
5
This very much depends on what market your users are in and whether or not they are paying you money for the API.
– 17 of 26
9 hours ago
1
And how quickly they are willing to adjust to change. If this is a SaaS API (as opposed to a packaged library), then you should definitely be keeping metrics on how much each of your endpoints is used.
– chrylis
7 hours ago
2
It also depends on why you "have" to depreciate it; is the old way a security risk? Did you just now find a reason why the old way is fundamentally and unfixably unstable due to an unfortunate design decision? Is the old way far slower now than it used to be? Are you running out of memory on your target system (e.g., an embedded system) and you literally cannot fit both APIs on it? Or did you just find a "better" way and you just want to clean out the old code to reduce your maintenance overhead?
– jrh
6 hours ago
|
show 1 more comment
up vote
17
down vote
favorite
up vote
17
down vote
favorite
I am maintaining a public API and have to deprecate a method.
Is there a general rule on how many months/years/versions before the deletion I should deprecate a method?
java deprecate java-annotation
I am maintaining a public API and have to deprecate a method.
Is there a general rule on how many months/years/versions before the deletion I should deprecate a method?
java deprecate java-annotation
java deprecate java-annotation
edited 6 hours ago
Kirk Kuykendall
1033
1033
asked 11 hours ago
deviDave
1,24851726
1,24851726
8
The general rule is "keep it around for as long as you and/or your customers need it."
– Robert Harvey
11 hours ago
6
Define "public". Free, open source software, with the usual "use at your own risk" disclaimer? Or sold software where a contract exists?
– Doc Brown
10 hours ago
5
This very much depends on what market your users are in and whether or not they are paying you money for the API.
– 17 of 26
9 hours ago
1
And how quickly they are willing to adjust to change. If this is a SaaS API (as opposed to a packaged library), then you should definitely be keeping metrics on how much each of your endpoints is used.
– chrylis
7 hours ago
2
It also depends on why you "have" to depreciate it; is the old way a security risk? Did you just now find a reason why the old way is fundamentally and unfixably unstable due to an unfortunate design decision? Is the old way far slower now than it used to be? Are you running out of memory on your target system (e.g., an embedded system) and you literally cannot fit both APIs on it? Or did you just find a "better" way and you just want to clean out the old code to reduce your maintenance overhead?
– jrh
6 hours ago
|
show 1 more comment
8
The general rule is "keep it around for as long as you and/or your customers need it."
– Robert Harvey
11 hours ago
6
Define "public". Free, open source software, with the usual "use at your own risk" disclaimer? Or sold software where a contract exists?
– Doc Brown
10 hours ago
5
This very much depends on what market your users are in and whether or not they are paying you money for the API.
– 17 of 26
9 hours ago
1
And how quickly they are willing to adjust to change. If this is a SaaS API (as opposed to a packaged library), then you should definitely be keeping metrics on how much each of your endpoints is used.
– chrylis
7 hours ago
2
It also depends on why you "have" to depreciate it; is the old way a security risk? Did you just now find a reason why the old way is fundamentally and unfixably unstable due to an unfortunate design decision? Is the old way far slower now than it used to be? Are you running out of memory on your target system (e.g., an embedded system) and you literally cannot fit both APIs on it? Or did you just find a "better" way and you just want to clean out the old code to reduce your maintenance overhead?
– jrh
6 hours ago
8
8
The general rule is "keep it around for as long as you and/or your customers need it."
– Robert Harvey
11 hours ago
The general rule is "keep it around for as long as you and/or your customers need it."
– Robert Harvey
11 hours ago
6
6
Define "public". Free, open source software, with the usual "use at your own risk" disclaimer? Or sold software where a contract exists?
– Doc Brown
10 hours ago
Define "public". Free, open source software, with the usual "use at your own risk" disclaimer? Or sold software where a contract exists?
– Doc Brown
10 hours ago
5
5
This very much depends on what market your users are in and whether or not they are paying you money for the API.
– 17 of 26
9 hours ago
This very much depends on what market your users are in and whether or not they are paying you money for the API.
– 17 of 26
9 hours ago
1
1
And how quickly they are willing to adjust to change. If this is a SaaS API (as opposed to a packaged library), then you should definitely be keeping metrics on how much each of your endpoints is used.
– chrylis
7 hours ago
And how quickly they are willing to adjust to change. If this is a SaaS API (as opposed to a packaged library), then you should definitely be keeping metrics on how much each of your endpoints is used.
– chrylis
7 hours ago
2
2
It also depends on why you "have" to depreciate it; is the old way a security risk? Did you just now find a reason why the old way is fundamentally and unfixably unstable due to an unfortunate design decision? Is the old way far slower now than it used to be? Are you running out of memory on your target system (e.g., an embedded system) and you literally cannot fit both APIs on it? Or did you just find a "better" way and you just want to clean out the old code to reduce your maintenance overhead?
– jrh
6 hours ago
It also depends on why you "have" to depreciate it; is the old way a security risk? Did you just now find a reason why the old way is fundamentally and unfixably unstable due to an unfortunate design decision? Is the old way far slower now than it used to be? Are you running out of memory on your target system (e.g., an embedded system) and you literally cannot fit both APIs on it? Or did you just find a "better" way and you just want to clean out the old code to reduce your maintenance overhead?
– jrh
6 hours ago
|
show 1 more comment
3 Answers
3
active
oldest
votes
up vote
25
down vote
At minimum, you should keep deprecated methods in one version before removing them which seems kind of obvious when I write it out. I don't think there is a maximum time but if you never actually remove them, deprecation becomes a little pointless.
Major version releases are a good time to remove deprecated methods. Minor releases should typically not contain breaking changes.
19
Deprecation isn't necessarily about eventual removal, so deprecation without removal isn't pointless (and is often the right thing if backward compatibility is important). Often the point is nothing more than "we have a better way now, so you shouldn't do it this way anymore".
– cHao
7 hours ago
4
@cHao If something is deprecated, you should not expect it to continue to be there. I suppose if you want to make a special statement in your project that states you will not remove deprecated functionality, that's fine but otherwise, yes it is implied that there will be eventual removal. The point I am making is that if you don't maintain some sort of rigor around this, people may come to believe that it won't ever happen. This has come up with recent versions of Java where functionality that has been deprecated for a decade or more is now being removed.
– JimmyJames
6 hours ago
2
@cHao I'd rather a project remove its deprecated functionality. Not only is there the benefit of users actually being motivated to switch, but it also prevents the deprecated interface from interfering with other improvements.
– jpmc26
5 hours ago
3
@cHao It's a context sensitive thing. In my experience the policy of deprecation is clear. It's clearly stated that deprecated functionality will be removed at some point in the future. Often deprecated functionality has issues making it problematic for use and it's not simply a matter of whether you value backward compatibility or not.
– JimmyJames
5 hours ago
1
I'm going to chime in to agree with @JimmyJames that deprecation clearly implies impending removal. The deprecation period exists as a way of providing temporary backwards compatibility so the consumers can migrate to the newer functionality. There should be absolutely no expectation that the deprecated functionality will remain indefinitely. If the old functionality is going to remain, there's no reason to deprecate it.
– Eric King
3 hours ago
|
show 7 more comments
up vote
5
down vote
This depends solely on what kind of stability guarantees you gave to your users, and how much pain you want to cause for your users.
Ideally, your API uses semver so that any breaking change causes the major version number to be incremented. In practice, it is desirable to do this almost never. If your API is installed via some package manager, you may want to create a new package name after a breaking change so that a simple upgrade doesn't cause conflicts (e.g. myapi2 v2.123.4
vs myapi3 v3.2.1
). That may be unnecessary if your package manager supports tighter version dependencies (e.g. a dependency specification like ~v2.120
that does not include v3.*
), but different package names have the advantage that incompatible versions can be used side by side very easily. Even when using semver, it can be sensible to have a deprecation period.
Semver is not always applicable. Then it is more important to communicate a clear stability policy. For example:
- Experimental features may be removed without notice.
- Features may be removed for security reasons at any time.
- Other features will only be removed
- … after having been deprecated in a released version
- … where that version is at least three months old
- … and will be marked by a bump in the major version.
Such policies work particularly well when you have regular releases so that there is a clear deprecation period, e.g. one year.
Aside from marking any parts of the API as deprecated, you should make the deprecation widely known. For example:
- Have a section in your changelog about future directions and deprecations.
- Broadcast your intention to deprecate before you perform the deprecation, and listen into the community to see if there are substantial objections.
- Communicate what benefits will come from these changes. Depending on your user base, newsletters, presentations, blog posts, or press releases might be appropriate media. Having a spin “we are creating an awesome new feature! (which requires this widely used old feature to be removed)” is a bit less frustrating than removing a feature without context.
As for the exact deprecation period to choose, first look whether you have to honor any support contracts with your users. Such contracts may require you to maintain compatibility for some period. If not, consider any downstream impact. Try to change less rapidly than downstream users so that they can go through a deprecation cycle of their own. Downstream users will take some time to adapt to your changes, so you should never have a deprecation period shorter than a month.
add a comment |
up vote
0
down vote
First you should consider whether you want deprecated or obsolete.
Deprecated should be used for methods that are in some way harmful: security, performance, incorrect results. You want to get rid of them relatively quickly, no more than 2 major version and gone by the 3rd. For significant enough problems, deprecated may be deleted in the next minor version.
Obsolete is for things that are less useful for some reason, for instance returns less information or doesn’t work as well, doesn’t include as many options and so forth. These can hang around indefinitely, but should at a minimum be present in the next major version.
add a comment |
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
25
down vote
At minimum, you should keep deprecated methods in one version before removing them which seems kind of obvious when I write it out. I don't think there is a maximum time but if you never actually remove them, deprecation becomes a little pointless.
Major version releases are a good time to remove deprecated methods. Minor releases should typically not contain breaking changes.
19
Deprecation isn't necessarily about eventual removal, so deprecation without removal isn't pointless (and is often the right thing if backward compatibility is important). Often the point is nothing more than "we have a better way now, so you shouldn't do it this way anymore".
– cHao
7 hours ago
4
@cHao If something is deprecated, you should not expect it to continue to be there. I suppose if you want to make a special statement in your project that states you will not remove deprecated functionality, that's fine but otherwise, yes it is implied that there will be eventual removal. The point I am making is that if you don't maintain some sort of rigor around this, people may come to believe that it won't ever happen. This has come up with recent versions of Java where functionality that has been deprecated for a decade or more is now being removed.
– JimmyJames
6 hours ago
2
@cHao I'd rather a project remove its deprecated functionality. Not only is there the benefit of users actually being motivated to switch, but it also prevents the deprecated interface from interfering with other improvements.
– jpmc26
5 hours ago
3
@cHao It's a context sensitive thing. In my experience the policy of deprecation is clear. It's clearly stated that deprecated functionality will be removed at some point in the future. Often deprecated functionality has issues making it problematic for use and it's not simply a matter of whether you value backward compatibility or not.
– JimmyJames
5 hours ago
1
I'm going to chime in to agree with @JimmyJames that deprecation clearly implies impending removal. The deprecation period exists as a way of providing temporary backwards compatibility so the consumers can migrate to the newer functionality. There should be absolutely no expectation that the deprecated functionality will remain indefinitely. If the old functionality is going to remain, there's no reason to deprecate it.
– Eric King
3 hours ago
|
show 7 more comments
up vote
25
down vote
At minimum, you should keep deprecated methods in one version before removing them which seems kind of obvious when I write it out. I don't think there is a maximum time but if you never actually remove them, deprecation becomes a little pointless.
Major version releases are a good time to remove deprecated methods. Minor releases should typically not contain breaking changes.
19
Deprecation isn't necessarily about eventual removal, so deprecation without removal isn't pointless (and is often the right thing if backward compatibility is important). Often the point is nothing more than "we have a better way now, so you shouldn't do it this way anymore".
– cHao
7 hours ago
4
@cHao If something is deprecated, you should not expect it to continue to be there. I suppose if you want to make a special statement in your project that states you will not remove deprecated functionality, that's fine but otherwise, yes it is implied that there will be eventual removal. The point I am making is that if you don't maintain some sort of rigor around this, people may come to believe that it won't ever happen. This has come up with recent versions of Java where functionality that has been deprecated for a decade or more is now being removed.
– JimmyJames
6 hours ago
2
@cHao I'd rather a project remove its deprecated functionality. Not only is there the benefit of users actually being motivated to switch, but it also prevents the deprecated interface from interfering with other improvements.
– jpmc26
5 hours ago
3
@cHao It's a context sensitive thing. In my experience the policy of deprecation is clear. It's clearly stated that deprecated functionality will be removed at some point in the future. Often deprecated functionality has issues making it problematic for use and it's not simply a matter of whether you value backward compatibility or not.
– JimmyJames
5 hours ago
1
I'm going to chime in to agree with @JimmyJames that deprecation clearly implies impending removal. The deprecation period exists as a way of providing temporary backwards compatibility so the consumers can migrate to the newer functionality. There should be absolutely no expectation that the deprecated functionality will remain indefinitely. If the old functionality is going to remain, there's no reason to deprecate it.
– Eric King
3 hours ago
|
show 7 more comments
up vote
25
down vote
up vote
25
down vote
At minimum, you should keep deprecated methods in one version before removing them which seems kind of obvious when I write it out. I don't think there is a maximum time but if you never actually remove them, deprecation becomes a little pointless.
Major version releases are a good time to remove deprecated methods. Minor releases should typically not contain breaking changes.
At minimum, you should keep deprecated methods in one version before removing them which seems kind of obvious when I write it out. I don't think there is a maximum time but if you never actually remove them, deprecation becomes a little pointless.
Major version releases are a good time to remove deprecated methods. Minor releases should typically not contain breaking changes.
answered 11 hours ago
JimmyJames
12.6k2049
12.6k2049
19
Deprecation isn't necessarily about eventual removal, so deprecation without removal isn't pointless (and is often the right thing if backward compatibility is important). Often the point is nothing more than "we have a better way now, so you shouldn't do it this way anymore".
– cHao
7 hours ago
4
@cHao If something is deprecated, you should not expect it to continue to be there. I suppose if you want to make a special statement in your project that states you will not remove deprecated functionality, that's fine but otherwise, yes it is implied that there will be eventual removal. The point I am making is that if you don't maintain some sort of rigor around this, people may come to believe that it won't ever happen. This has come up with recent versions of Java where functionality that has been deprecated for a decade or more is now being removed.
– JimmyJames
6 hours ago
2
@cHao I'd rather a project remove its deprecated functionality. Not only is there the benefit of users actually being motivated to switch, but it also prevents the deprecated interface from interfering with other improvements.
– jpmc26
5 hours ago
3
@cHao It's a context sensitive thing. In my experience the policy of deprecation is clear. It's clearly stated that deprecated functionality will be removed at some point in the future. Often deprecated functionality has issues making it problematic for use and it's not simply a matter of whether you value backward compatibility or not.
– JimmyJames
5 hours ago
1
I'm going to chime in to agree with @JimmyJames that deprecation clearly implies impending removal. The deprecation period exists as a way of providing temporary backwards compatibility so the consumers can migrate to the newer functionality. There should be absolutely no expectation that the deprecated functionality will remain indefinitely. If the old functionality is going to remain, there's no reason to deprecate it.
– Eric King
3 hours ago
|
show 7 more comments
19
Deprecation isn't necessarily about eventual removal, so deprecation without removal isn't pointless (and is often the right thing if backward compatibility is important). Often the point is nothing more than "we have a better way now, so you shouldn't do it this way anymore".
– cHao
7 hours ago
4
@cHao If something is deprecated, you should not expect it to continue to be there. I suppose if you want to make a special statement in your project that states you will not remove deprecated functionality, that's fine but otherwise, yes it is implied that there will be eventual removal. The point I am making is that if you don't maintain some sort of rigor around this, people may come to believe that it won't ever happen. This has come up with recent versions of Java where functionality that has been deprecated for a decade or more is now being removed.
– JimmyJames
6 hours ago
2
@cHao I'd rather a project remove its deprecated functionality. Not only is there the benefit of users actually being motivated to switch, but it also prevents the deprecated interface from interfering with other improvements.
– jpmc26
5 hours ago
3
@cHao It's a context sensitive thing. In my experience the policy of deprecation is clear. It's clearly stated that deprecated functionality will be removed at some point in the future. Often deprecated functionality has issues making it problematic for use and it's not simply a matter of whether you value backward compatibility or not.
– JimmyJames
5 hours ago
1
I'm going to chime in to agree with @JimmyJames that deprecation clearly implies impending removal. The deprecation period exists as a way of providing temporary backwards compatibility so the consumers can migrate to the newer functionality. There should be absolutely no expectation that the deprecated functionality will remain indefinitely. If the old functionality is going to remain, there's no reason to deprecate it.
– Eric King
3 hours ago
19
19
Deprecation isn't necessarily about eventual removal, so deprecation without removal isn't pointless (and is often the right thing if backward compatibility is important). Often the point is nothing more than "we have a better way now, so you shouldn't do it this way anymore".
– cHao
7 hours ago
Deprecation isn't necessarily about eventual removal, so deprecation without removal isn't pointless (and is often the right thing if backward compatibility is important). Often the point is nothing more than "we have a better way now, so you shouldn't do it this way anymore".
– cHao
7 hours ago
4
4
@cHao If something is deprecated, you should not expect it to continue to be there. I suppose if you want to make a special statement in your project that states you will not remove deprecated functionality, that's fine but otherwise, yes it is implied that there will be eventual removal. The point I am making is that if you don't maintain some sort of rigor around this, people may come to believe that it won't ever happen. This has come up with recent versions of Java where functionality that has been deprecated for a decade or more is now being removed.
– JimmyJames
6 hours ago
@cHao If something is deprecated, you should not expect it to continue to be there. I suppose if you want to make a special statement in your project that states you will not remove deprecated functionality, that's fine but otherwise, yes it is implied that there will be eventual removal. The point I am making is that if you don't maintain some sort of rigor around this, people may come to believe that it won't ever happen. This has come up with recent versions of Java where functionality that has been deprecated for a decade or more is now being removed.
– JimmyJames
6 hours ago
2
2
@cHao I'd rather a project remove its deprecated functionality. Not only is there the benefit of users actually being motivated to switch, but it also prevents the deprecated interface from interfering with other improvements.
– jpmc26
5 hours ago
@cHao I'd rather a project remove its deprecated functionality. Not only is there the benefit of users actually being motivated to switch, but it also prevents the deprecated interface from interfering with other improvements.
– jpmc26
5 hours ago
3
3
@cHao It's a context sensitive thing. In my experience the policy of deprecation is clear. It's clearly stated that deprecated functionality will be removed at some point in the future. Often deprecated functionality has issues making it problematic for use and it's not simply a matter of whether you value backward compatibility or not.
– JimmyJames
5 hours ago
@cHao It's a context sensitive thing. In my experience the policy of deprecation is clear. It's clearly stated that deprecated functionality will be removed at some point in the future. Often deprecated functionality has issues making it problematic for use and it's not simply a matter of whether you value backward compatibility or not.
– JimmyJames
5 hours ago
1
1
I'm going to chime in to agree with @JimmyJames that deprecation clearly implies impending removal. The deprecation period exists as a way of providing temporary backwards compatibility so the consumers can migrate to the newer functionality. There should be absolutely no expectation that the deprecated functionality will remain indefinitely. If the old functionality is going to remain, there's no reason to deprecate it.
– Eric King
3 hours ago
I'm going to chime in to agree with @JimmyJames that deprecation clearly implies impending removal. The deprecation period exists as a way of providing temporary backwards compatibility so the consumers can migrate to the newer functionality. There should be absolutely no expectation that the deprecated functionality will remain indefinitely. If the old functionality is going to remain, there's no reason to deprecate it.
– Eric King
3 hours ago
|
show 7 more comments
up vote
5
down vote
This depends solely on what kind of stability guarantees you gave to your users, and how much pain you want to cause for your users.
Ideally, your API uses semver so that any breaking change causes the major version number to be incremented. In practice, it is desirable to do this almost never. If your API is installed via some package manager, you may want to create a new package name after a breaking change so that a simple upgrade doesn't cause conflicts (e.g. myapi2 v2.123.4
vs myapi3 v3.2.1
). That may be unnecessary if your package manager supports tighter version dependencies (e.g. a dependency specification like ~v2.120
that does not include v3.*
), but different package names have the advantage that incompatible versions can be used side by side very easily. Even when using semver, it can be sensible to have a deprecation period.
Semver is not always applicable. Then it is more important to communicate a clear stability policy. For example:
- Experimental features may be removed without notice.
- Features may be removed for security reasons at any time.
- Other features will only be removed
- … after having been deprecated in a released version
- … where that version is at least three months old
- … and will be marked by a bump in the major version.
Such policies work particularly well when you have regular releases so that there is a clear deprecation period, e.g. one year.
Aside from marking any parts of the API as deprecated, you should make the deprecation widely known. For example:
- Have a section in your changelog about future directions and deprecations.
- Broadcast your intention to deprecate before you perform the deprecation, and listen into the community to see if there are substantial objections.
- Communicate what benefits will come from these changes. Depending on your user base, newsletters, presentations, blog posts, or press releases might be appropriate media. Having a spin “we are creating an awesome new feature! (which requires this widely used old feature to be removed)” is a bit less frustrating than removing a feature without context.
As for the exact deprecation period to choose, first look whether you have to honor any support contracts with your users. Such contracts may require you to maintain compatibility for some period. If not, consider any downstream impact. Try to change less rapidly than downstream users so that they can go through a deprecation cycle of their own. Downstream users will take some time to adapt to your changes, so you should never have a deprecation period shorter than a month.
add a comment |
up vote
5
down vote
This depends solely on what kind of stability guarantees you gave to your users, and how much pain you want to cause for your users.
Ideally, your API uses semver so that any breaking change causes the major version number to be incremented. In practice, it is desirable to do this almost never. If your API is installed via some package manager, you may want to create a new package name after a breaking change so that a simple upgrade doesn't cause conflicts (e.g. myapi2 v2.123.4
vs myapi3 v3.2.1
). That may be unnecessary if your package manager supports tighter version dependencies (e.g. a dependency specification like ~v2.120
that does not include v3.*
), but different package names have the advantage that incompatible versions can be used side by side very easily. Even when using semver, it can be sensible to have a deprecation period.
Semver is not always applicable. Then it is more important to communicate a clear stability policy. For example:
- Experimental features may be removed without notice.
- Features may be removed for security reasons at any time.
- Other features will only be removed
- … after having been deprecated in a released version
- … where that version is at least three months old
- … and will be marked by a bump in the major version.
Such policies work particularly well when you have regular releases so that there is a clear deprecation period, e.g. one year.
Aside from marking any parts of the API as deprecated, you should make the deprecation widely known. For example:
- Have a section in your changelog about future directions and deprecations.
- Broadcast your intention to deprecate before you perform the deprecation, and listen into the community to see if there are substantial objections.
- Communicate what benefits will come from these changes. Depending on your user base, newsletters, presentations, blog posts, or press releases might be appropriate media. Having a spin “we are creating an awesome new feature! (which requires this widely used old feature to be removed)” is a bit less frustrating than removing a feature without context.
As for the exact deprecation period to choose, first look whether you have to honor any support contracts with your users. Such contracts may require you to maintain compatibility for some period. If not, consider any downstream impact. Try to change less rapidly than downstream users so that they can go through a deprecation cycle of their own. Downstream users will take some time to adapt to your changes, so you should never have a deprecation period shorter than a month.
add a comment |
up vote
5
down vote
up vote
5
down vote
This depends solely on what kind of stability guarantees you gave to your users, and how much pain you want to cause for your users.
Ideally, your API uses semver so that any breaking change causes the major version number to be incremented. In practice, it is desirable to do this almost never. If your API is installed via some package manager, you may want to create a new package name after a breaking change so that a simple upgrade doesn't cause conflicts (e.g. myapi2 v2.123.4
vs myapi3 v3.2.1
). That may be unnecessary if your package manager supports tighter version dependencies (e.g. a dependency specification like ~v2.120
that does not include v3.*
), but different package names have the advantage that incompatible versions can be used side by side very easily. Even when using semver, it can be sensible to have a deprecation period.
Semver is not always applicable. Then it is more important to communicate a clear stability policy. For example:
- Experimental features may be removed without notice.
- Features may be removed for security reasons at any time.
- Other features will only be removed
- … after having been deprecated in a released version
- … where that version is at least three months old
- … and will be marked by a bump in the major version.
Such policies work particularly well when you have regular releases so that there is a clear deprecation period, e.g. one year.
Aside from marking any parts of the API as deprecated, you should make the deprecation widely known. For example:
- Have a section in your changelog about future directions and deprecations.
- Broadcast your intention to deprecate before you perform the deprecation, and listen into the community to see if there are substantial objections.
- Communicate what benefits will come from these changes. Depending on your user base, newsletters, presentations, blog posts, or press releases might be appropriate media. Having a spin “we are creating an awesome new feature! (which requires this widely used old feature to be removed)” is a bit less frustrating than removing a feature without context.
As for the exact deprecation period to choose, first look whether you have to honor any support contracts with your users. Such contracts may require you to maintain compatibility for some period. If not, consider any downstream impact. Try to change less rapidly than downstream users so that they can go through a deprecation cycle of their own. Downstream users will take some time to adapt to your changes, so you should never have a deprecation period shorter than a month.
This depends solely on what kind of stability guarantees you gave to your users, and how much pain you want to cause for your users.
Ideally, your API uses semver so that any breaking change causes the major version number to be incremented. In practice, it is desirable to do this almost never. If your API is installed via some package manager, you may want to create a new package name after a breaking change so that a simple upgrade doesn't cause conflicts (e.g. myapi2 v2.123.4
vs myapi3 v3.2.1
). That may be unnecessary if your package manager supports tighter version dependencies (e.g. a dependency specification like ~v2.120
that does not include v3.*
), but different package names have the advantage that incompatible versions can be used side by side very easily. Even when using semver, it can be sensible to have a deprecation period.
Semver is not always applicable. Then it is more important to communicate a clear stability policy. For example:
- Experimental features may be removed without notice.
- Features may be removed for security reasons at any time.
- Other features will only be removed
- … after having been deprecated in a released version
- … where that version is at least three months old
- … and will be marked by a bump in the major version.
Such policies work particularly well when you have regular releases so that there is a clear deprecation period, e.g. one year.
Aside from marking any parts of the API as deprecated, you should make the deprecation widely known. For example:
- Have a section in your changelog about future directions and deprecations.
- Broadcast your intention to deprecate before you perform the deprecation, and listen into the community to see if there are substantial objections.
- Communicate what benefits will come from these changes. Depending on your user base, newsletters, presentations, blog posts, or press releases might be appropriate media. Having a spin “we are creating an awesome new feature! (which requires this widely used old feature to be removed)” is a bit less frustrating than removing a feature without context.
As for the exact deprecation period to choose, first look whether you have to honor any support contracts with your users. Such contracts may require you to maintain compatibility for some period. If not, consider any downstream impact. Try to change less rapidly than downstream users so that they can go through a deprecation cycle of their own. Downstream users will take some time to adapt to your changes, so you should never have a deprecation period shorter than a month.
answered 9 hours ago
amon
82.2k21155240
82.2k21155240
add a comment |
add a comment |
up vote
0
down vote
First you should consider whether you want deprecated or obsolete.
Deprecated should be used for methods that are in some way harmful: security, performance, incorrect results. You want to get rid of them relatively quickly, no more than 2 major version and gone by the 3rd. For significant enough problems, deprecated may be deleted in the next minor version.
Obsolete is for things that are less useful for some reason, for instance returns less information or doesn’t work as well, doesn’t include as many options and so forth. These can hang around indefinitely, but should at a minimum be present in the next major version.
add a comment |
up vote
0
down vote
First you should consider whether you want deprecated or obsolete.
Deprecated should be used for methods that are in some way harmful: security, performance, incorrect results. You want to get rid of them relatively quickly, no more than 2 major version and gone by the 3rd. For significant enough problems, deprecated may be deleted in the next minor version.
Obsolete is for things that are less useful for some reason, for instance returns less information or doesn’t work as well, doesn’t include as many options and so forth. These can hang around indefinitely, but should at a minimum be present in the next major version.
add a comment |
up vote
0
down vote
up vote
0
down vote
First you should consider whether you want deprecated or obsolete.
Deprecated should be used for methods that are in some way harmful: security, performance, incorrect results. You want to get rid of them relatively quickly, no more than 2 major version and gone by the 3rd. For significant enough problems, deprecated may be deleted in the next minor version.
Obsolete is for things that are less useful for some reason, for instance returns less information or doesn’t work as well, doesn’t include as many options and so forth. These can hang around indefinitely, but should at a minimum be present in the next major version.
First you should consider whether you want deprecated or obsolete.
Deprecated should be used for methods that are in some way harmful: security, performance, incorrect results. You want to get rid of them relatively quickly, no more than 2 major version and gone by the 3rd. For significant enough problems, deprecated may be deleted in the next minor version.
Obsolete is for things that are less useful for some reason, for instance returns less information or doesn’t work as well, doesn’t include as many options and so forth. These can hang around indefinitely, but should at a minimum be present in the next major version.
answered 1 hour ago
jmoreno
8,67412142
8,67412142
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsoftwareengineering.stackexchange.com%2fquestions%2f381763%2fhow-long-to-wait-before-deleting-a-deprecated-method%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
8
The general rule is "keep it around for as long as you and/or your customers need it."
– Robert Harvey
11 hours ago
6
Define "public". Free, open source software, with the usual "use at your own risk" disclaimer? Or sold software where a contract exists?
– Doc Brown
10 hours ago
5
This very much depends on what market your users are in and whether or not they are paying you money for the API.
– 17 of 26
9 hours ago
1
And how quickly they are willing to adjust to change. If this is a SaaS API (as opposed to a packaged library), then you should definitely be keeping metrics on how much each of your endpoints is used.
– chrylis
7 hours ago
2
It also depends on why you "have" to depreciate it; is the old way a security risk? Did you just now find a reason why the old way is fundamentally and unfixably unstable due to an unfortunate design decision? Is the old way far slower now than it used to be? Are you running out of memory on your target system (e.g., an embedded system) and you literally cannot fit both APIs on it? Or did you just find a "better" way and you just want to clean out the old code to reduce your maintenance overhead?
– jrh
6 hours ago