如何处理库中的函数弃用? [英] How to handle functions deprecation in library?

查看:35
本文介绍了如何处理库中的函数弃用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个 Java 库,并想从中删除一些功能.我这样做的原因是公共 API 和设计清理.一些对象有 setter,但应该是不可变的,一些功能在不同的方法中实现得更好/更清晰,等等.

I'm working on a Java library and would like to remove some functions from it. My reasons for this is public API and design cleanup. Some objects have setters, but should be immutable, some functionality has been implemented better/cleaner in different methods, etc.

我已将这些方法标记为已弃用",并希望最终将其删除.目前我正在考虑在几次冲刺(两周开发周期)后删除这些.

I have marked these methods 'deprecated', and would like to remove them eventually. At the moment I'm thinking about removing these after few sprints (two week development cycles).

是否有任何关于删除冗余公共代码的最佳实践"?

Are there any 'best practices' about removing redundant public code?

/JaanusSiim

/JaanusSiim

推荐答案

设置日期并在@deprecated 标签中公布.移除的时间取决于您的代码拥有的用户数量、您与他们的联系程度以及更改的原因.

Set a date and publicize it in the @deprecated tag. The amount of time given to the removal depends on the amount of users your code has, how well connected you are with them and the the reason for the change.

如果您有成千上万的用户并且您几乎不与他们交谈,那么时间范围可能应该在几十年的范围内:-)

If you have thousands of users and you barely talk to them, the time frame should probably be in the decades range :-)

如果您的用户是您的 10 位同事并且您每天都看到他们,那么时间范围很容易在几周范围内.

If your users are your 10 coworkers and you see them daily, the time frame can easily be in the weeks range.

/**
 * @deprecated
 * This method will be removed after Halloween!
 * @see #newLocationForFunctionality
 */

这篇关于如何处理库中的函数弃用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆