如何管理多个执行相似操作的程序?

发布于 2024-09-14 19:10:36 字数 1431 浏览 4 评论 0原文

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

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

发布评论

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

评论(3

世界和平 2024-09-21 19:10:36

怎么样:

  • 维护公共部分的连贯代码库
  • 在软件的两个“版本”需要做不同事情的每个地方,调用一个函数
  • 在特定于“版本”的源文件中声明该函数
  • 有两个这样的源文件你可以换入和换出

这在 PHP 中特别容易,你实际上可以在文件中的某处声明一个全局函数。

How about:

  • Maintain a coherent codebase of the common parts
  • In every place where the two “versions” of the software need to do something different, call a function
  • Declare that function in a “version”-specific source file
  • Have two such source files that you can swap in and out

This is particularly easy in PHP where you can really just declare a global function in a file somewhere.

朮生 2024-09-21 19:10:36

我建议阅读 Martin Fowler 所著的重构书的第一章。它解决了一个非常相似的困境。

I would recommend reading first chapter of the refactoring book, by Martin Fowler. It deals with a very similar dilemma.

隐诗 2024-09-21 19:10:36

感谢您提交的答案。

我和我的团队决定使用 Subversion 中的分支和标签来管理这个问题。

我们将维护一个代码主干作为基本程序。当我们需要为新市场大量修改主干时,我们将从主干创建一个分支并在那里进行必要的更改。

这将使我们能够很好地记录我们所做的所有更改及其应用位置。

Thank you for the submitted answers.

My team and I have decided to manage this issue using branches and tags in Subversion.

We will maintain a trunk of code that will serve as the base program. When we need to heavily modify the trunk for a new market, we will create a branch from the trunk and make the necessary changes there.

This will allow us the keep very good records of all the changes we make and where they have been applied.

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