具有通用代码的多个应用程序——如何解决这个问题?
我的公司有两三个使用大量通用代码的 Web 应用程序——自定义 MVC 框架、实用程序类、JavaScript 库等等。
我们不希望在每个应用程序中重复所有这些代码,因为我们最终会使用它的几个略有不同的版本。 但我们不希望应用程序需要此代码的相同副本,因为我们不希望对一个应用程序的更新可能会破坏另一个应用程序。
有人对处理这个问题有什么建议吗? 我不认为我在寻找技术答案——更多的是一种通用方法。
我们可以将代码放入库中,并允许应用程序保留在旧版本的库中,直到准备好升级为止。 或者我们可以将其放入多个库中,这样我们就不必立即升级所有内容。 但是管理库版本之间的相互依赖关系会变得困难吗?
My company has two or three web apps that use a lot of common code -- a custom MVC framework, utility classes, JavaScript libraries, and so on.
We'd prefer not to duplicate all this code in each app, because we end up with several slightly different versions of it in use. But we don't want the apps to require the same exact copy of this code, because we don't want an update to one app to potentially break another.
Does anyone have any tips on dealing with this problem? I don't think I'm looking for a technical answer -- more of just a general approach.
We could make the code into a library, and allow apps to remain on an older version of the library until they're ready to upgrade. Or we could make it into multiple libraries, so we don't have to upgrade everything at once. But would it become difficult to manage the interdependencies between versions of the libraries?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我将 SVN 与 svn:externals 一起使用。 你想要稳定的东西应该放在标签文件夹中,这样依赖的项目就不会受到主干中其他开发的影响。
I use SVN with svn:externals. Things you want to be stable should be in the tags folder so dependent projects don't get affected by other developments in the trunk.
这取决于很多很多因素——不同的语言对于库有不同的行为。 我通常处理这个问题的方法是让每个应用程序对其外部依赖项(包括我编写的库)进行一系列测试,并使用它来防止对所述库的升级破坏应用程序。
有关您正在使用的平台的更多详细信息吗? 可能有特定的工具可以帮助满足您的特定需求。
It depends on many, many factors -- different languages have different behaviors with regards to libraries. The way I generally handle this is to have each app have a battery of tests for its external dependencies, including libraries that I've written, and to use this to keep upgrades to said libraries from breaking the app.
Any more details regarding the platform you're using? There may be specific tools that will help with your particular needs.
我用 svn:externals 来支持 SVN。 我们有一个共享一些代码的客户端和服务器。 代码在服务器下维护(但可以移出到自己的存储库),客户端使用 svn:externals 将其拉入。 客户端主干从服务器主干拉出。 但是,当我们分支(例如发布)时,我们会将外部拉入特定的版本、分支或标签。 如果您不这样做并且返回旧分支并更新,您可能会得到共享代码的主干,这很可能不是您想要的。
I second the SVN with svn:externals. We have a client and server that share some code. The code is maintained under the server (but could be moved out to its own repo) and the client pulls it in with svn:externals. The client trunk pulls from server trunk. But when we branch (say for release) then we peg the pulled in external at a specific rev, branch or tag. If you don't do that and you go back to an old branch and update, you may get the trunk of the shared code, which is most likely not what you want.
我将为代表最新和最好版本的公共代码创建一个源代码控制分支。
然后,对于每个项目都有自己独立的代码分支,您可以在需要时进行快速修复,或者在接近发布时保持稳定性。
您可能希望有一个 Wiki,其中列出了在公共代码中发现的错误,以便共享代码的其他用户知道它并有时间在闲暇时修复它。
Git 可以很好地解决这个问题,因为它擅长将更改合并回“master”分支。
I would create one source control branch for the common code representing the latest and greatest version.
Then for each project have your own independent branch of that code where you can make quick fixes where needed or have stability when close to a release.
You may want to have a Wiki where bugs found in the common code are listed so the other users of the shared code are aware of it and get time to fix it at their leisure.
Git would work well for this since it is good at merging changes back to the 'master' branch.