不同版本的第三方库的实用程序设计

发布于 2024-10-04 01:23:30 字数 268 浏览 0 评论 0原文

我继承了一个应用此类解决方案的项目:

有 5 个版本的 3rd 方库。解决方案中有 5 个项目,其中包含相应版本的 3rd 方库的实用程序。

解决方案中的很多实用程序类对于所有版本的第 3 方库都具有相同的代码。重复问题是这样解决的——所有项目需要相同的代码文件存储在某个公共文件夹中,并作为链接添加到所有项目。

我不认为使用链接来共享代码是最好的方法。 您能否告诉我这是否是一个不好的方法,如果是这样,请告诉我解决此类代码重复的正确方法是什么?

提前致谢。

I've inherited a project where such solution is applied:

There are 5 versions of 3rd party library. And there 5 projects in the solution with utilities for corresponding version of 3rd party library.

Quite a lot of utility classes in the solution have identical code for all versions of 3rd party library. The duplication problem is solved in such way - the code files that need to be the same for all projects are stored in some common folder and added as a link to all projects.

I do not feel that using links to share code is the best approach.
Could you tell me if it is a bad approach and if it is so, please tell me what is the right way to .resolve such code duplication?

Thanks in advance.

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

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

发布评论

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

评论(1

我不是你的备胎 2024-10-11 01:23:31

这是否“不好”是相当主观的。

链接代码文件是可能的有一个原因 - 有时有必要在多个项目之间共享这样的文件。

根据第三方库在版本之间的差异程度 - 可能可以编写一些包装器代码来处理这些差异并将其隔离开来。

It's fairly subjective as to whether this is 'bad'.

Linked code files are possible for a reason - sometimes it is necessary to share files like this between multiple projects.

Depending on how different the third party library is between versions - it might be possible to write some wrapper code which deals with these differences and isolates this away.

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