您如何对待遗留代码(和数据)?

发布于 2024-07-05 02:23:09 字数 1452 浏览 6 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

莫言歌 2024-07-12 02:23:09

这取决于您所谓的“遗留”。 如果说遗留,你的意思是“来自某个已退役应用程序的代码,非常糟糕,我们永远不会再使用它”,那么它应该与你当前的代码分开。
如果它是来自您当前项目的内容,但由其他人编写或不符合您当前的标准,请正常对待它,但将其标记为将来在问题跟踪器中重构。

It depends on what you call legacy. If by saying legacy you really mean 'code from some retired application which is so bad we'll never use it any more' it should be separated from you current code.
If it is something from your current project but is written by other people or is not up to your current standards just treat it normally but flag it for re-factoring in the future in your issue tracker.

似最初 2024-07-12 02:23:09

使用外部定义 (svn:externals 属性)来引用您的遗留代码,就像引用第三方存储库一样。

然后,您可以将重构工作与依赖项目分开,并且(使用固定修订版引用,即 -r1234)非常明确地了解依赖项目所依赖的遗留代码的哪个修订版。

Use Externals Definitions (svn:externals property) to reference your legacy code as you would a third-party repository.

Then you can separate your refactoring work from your dependent projects and (using fixed revision references i.e. -r1234) be very explicit about which revision of the legacy code the dependent project depends on.

一笔一画续写前缘 2024-07-12 02:23:09

标记是颠覆中非常便宜的操作。 当您开始重构时以及在重构过程中的常规阶段标记您的代码。 这样,仍然可以轻松访问旧的(但功能正常的代码)作为闪亮的新代码(但损坏的代码)的参考。 :-)

Tagging is a very cheap operation in subversion. Tag your code when you start refactoring and at regular stages while you go along. That way it's easy to still access the old (but functional code) as a reference for your shiny new (but broken code). :-)

无妨# 2024-07-12 02:23:09

这是您的免费心理分析:

您在这里有一种根深蒂固的愿望,希望修复您的遗留代码,使其不再是遗留代码。 当你把它藏起来时,你只是在压抑这种欲望,试图避免它,因为这是一种不舒服的感觉。 如果你把它放在公开的地方,就会发生以下两种情况之一:它最终会让你发疯,你将不得不自杀,或者(更乐观地),你会想起每一个混乱的点,然后直到你最终分解并清理干净。

不要隐藏混乱; 打扫。 不然迟早它会回来咬你。

Here's your free psychological analysis:

What you have here is a deep-rooted desire to fix your legacy code so that it's not legacy anymore. When you hide it away, you're just repressing that desire, trying to avoid it because it's an uncomfortable feeling. If you leave it out in the open, one of two things will happen: it'll eventually drive you and insane and you'll have to kill yourself, or (more optimistically), you'll be reminded of each messy bit over and over until you finally break down and clean it up.

Don't hide the mess; clean it. Otherwise it'll come back to bite you sooner or later.

迷离° 2024-07-12 02:23:09

总有一天,所有代码都会成为“遗留”代码,为什么还要将它们分开呢? 源代码控制是按项目/分支或项目/平台/分支以及该类型的层次结构进行的。 谁在乎牙齿有多长?

All code becomes 'legacy' one day, why seperate it at all? Source control is by project/branch or project/platform/branch and that type of hierarchy. Who cares how long in the tooth it is?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文