Loading...
Loading...
Compare original and translation side by side
1. Does this system still provide unique value?
→ If yes, maintain it. If no, proceed.
2. How many users/consumers depend on it?
→ Quantify the migration scope.
3. Does a replacement exist?
→ If no, build the replacement first. Don't deprecate without an alternative.
4. What's the migration cost for each consumer?
→ If trivially automated, do it. If manual and high-effort, weigh against maintenance cost.
5. What's the ongoing maintenance cost of NOT deprecating?
→ Security risk, engineer time, opportunity cost of complexity.1. 该系统是否仍提供独一无二的价值?
→ 是则继续维护,否则进入下一步。
2. 有多少用户/调用方依赖该系统?
→ 量化迁移的范围。
3. 是否有可用的替代方案?
→ 没有就先搭建替代方案,没有替代品的情况下不要启动弃用。
4. 每个调用方的迁移成本是多少?
→ 如果可以轻松自动化就自动迁移,如果是高成本的手动迁移,就和维护成本做权衡。
5. 不弃用的持续维护成本是多少?
→ 包括安全风险、工程师时间消耗、系统复杂度带来的机会成本。| Type | When to Use | Mechanism |
|---|---|---|
| Advisory | Migration is optional, old system is stable | Warnings, documentation, nudges. Users migrate on their own timeline. |
| Compulsory | Old system has security issues, blocks progress, or maintenance cost is unsustainable | Hard deadline. Old system will be removed by date X. Provide migration tooling. |
| 类型 | 适用场景 | 实现方式 |
|---|---|---|
| 建议弃用 | 迁移是可选的,旧系统仍然稳定 | 告警提示、文档说明、引导提示。用户可以按自己的节奏完成迁移。 |
| 强制弃用 | 旧系统存在安全问题、阻碍开发进度,或者维护成本已经不可持续 | 设置明确的截止日期,旧系统会在指定日期被移除,同时提供迁移工具支持。 |
undefinedundefinedimport { client } from 'old-service'import { client } from 'new-service'npx migrate-checkundefinedimport { client } from 'old-service'import { client } from 'new-service'npx migrate-checkundefined1. Identify all touchpoints with the deprecated system
2. Update to use the replacement
3. Verify behavior matches (tests, integration checks)
4. Remove references to the old system
5. Confirm no regressions1. 识别所有和待弃用系统的交互点
2. 替换为使用新的替代系统
3. 校验行为一致性(测试、集成校验)
4. 移除所有对旧系统的引用
5. 确认没有出现回归问题1. Verify zero active usage (metrics, logs, dependency analysis)
2. Remove the code
3. Remove associated tests, documentation, and configuration
4. Remove the deprecation notices
5. Celebrate — removing code is an achievement1. 确认没有活跃使用(通过指标、日志、依赖分析校验)
2. 移除旧代码
3. 移除关联的测试、文档和配置
4. 移除弃用公告
5. 庆祝——移除代码也是一项成就Phase 1: New system handles 0%, old handles 100%
Phase 2: New system handles 10% (canary)
Phase 3: New system handles 50%
Phase 4: New system handles 100%, old system idle
Phase 5: Remove old system阶段1:新系统处理0%流量,旧系统处理100%
阶段2:新系统处理10%流量(金丝雀验证)
阶段3:新系统处理50%流量
阶段4:新系统处理100%流量,旧系统闲置
阶段5:移除旧系统// Adapter: old interface, new implementation
class LegacyTaskService implements OldTaskAPI {
constructor(private newService: NewTaskService) {}
// Old method signature, delegates to new implementation
getTask(id: number): OldTask {
const task = this.newService.findById(String(id));
return this.toOldFormat(task);
}
}// 适配器:旧接口,新实现
class LegacyTaskService implements OldTaskAPI {
constructor(private newService: NewTaskService) {}
// 旧方法签名,代理到新实现
getTask(id: number): OldTask {
const task = this.newService.findById(String(id));
return this.toOldFormat(task);
}
}function getTaskService(userId: string): TaskService {
if (featureFlags.isEnabled('new-task-service', { userId })) {
return new NewTaskService();
}
return new LegacyTaskService();
}function getTaskService(userId: string): TaskService {
if (featureFlags.isEnabled('new-task-service', { userId })) {
return new NewTaskService();
}
return new LegacyTaskService();
}| Rationalization | Reality |
|---|---|
| "It still works, why remove it?" | Working code that nobody maintains accumulates security debt and complexity. Maintenance cost grows silently. |
| "Someone might need it later" | If it's needed later, it can be rebuilt. Keeping unused code "just in case" costs more than rebuilding. |
| "The migration is too expensive" | Compare migration cost to ongoing maintenance cost over 2-3 years. Migration is usually cheaper long-term. |
| "We'll deprecate it after we finish the new system" | Deprecation planning starts at design time. By the time the new system is done, you'll have new priorities. Plan now. |
| "Users will migrate on their own" | They won't. Provide tooling, documentation, and incentives — or do the migration yourself (the Churn Rule). |
| "We can maintain both systems indefinitely" | Two systems doing the same thing is double the maintenance, testing, documentation, and onboarding cost. |
| 借口 | 现实情况 |
|---|---|
| 「它还能用,为什么要移除?」 | 没有人维护的可用代码会累积安全债务和复杂度,维护成本会悄无声息地增长。 |
| 「以后可能有人会用到」 | 如果以后真的需要,可以重新构建。「以防万一」保留无用代码的成本比重新构建更高。 |
| 「迁移成本太高了」 | 把迁移成本和未来2-3年的持续维护成本做对比,长期来看迁移通常成本更低。 |
| 「我们做完新系统之后再做弃用」 | 弃用规划从设计阶段就应该启动,等新系统做完的时候,你已经有新的优先级了,现在就做规划。 |
| 「用户会自己完成迁移的」 | 他们不会的。你需要提供工具、文档和激励——或者自己完成迁移(churn规则)。 |
| 「我们可以无限期同时维护两个系统」 | 两个实现相同功能的系统意味着双倍的维护、测试、文档和新人上手成本。 |