我正在为教师的时间表建立一个图书馆。
但我想知道我是否应该把一门课放在“不推荐”一词中。
以下是我的情况:
在图书馆里,我有一个Schedule课程,从学校网站上收集时间表。
另一个ScheduleProxy类将已经发出的请求保存在缓存中,从而避免了第二次相同的请求。
第一种解决方案是@Deprecated:
日程安排
/**
*
* @deprecated For the use of the Schedule class, it is preferable
* to use its proxy: {@link ScheduleProxy} in order to have better response times.
*
* @see InterfaceSchedule
* @see ScheduleProxy
*/
@Deprecated(forRemoval = false)
public final class Schedule implements InterfaceSchedule {
/*
* Code
*
*/
}ScheduleProxy
public final class ScheduleProxy implements InterfaceSchedule{
/*
* Code
*
*/
}第二种解决方案不受欢迎:
日程安排
我将公共包改为私有包Schedule类,这样用户就不会使用这个类。
/**
*
* @see InterfaceSchedule
* @see Schedule
*/
final class ConcreteSchedule implements InterfaceSchedule {
/*
* Code
*
*/
}ScheduleProxy
我将类名从"ScheduleProxy“更改为"Schedule”,以便对库用户更清晰。
public final class Schedule implements InterfaceSchedule{
/*
* Code
*
*/
}问题
所以我想问你这两种解决方案中哪一种更适合使用?
发布于 2021-02-14 11:52:28
第二种解决方案对用户来说更直观,使您不可能使用您实际上不想使用的API。我会说这样更好。
https://stackoverflow.com/questions/66191469
复制相似问题