不同版本的第三方库的实用程序设计
我继承了一个应用此类解决方案的项目:
有 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是否“不好”是相当主观的。
链接代码文件是可能的有一个原因 - 有时有必要在多个项目之间共享这样的文件。
根据第三方库在版本之间的差异程度 - 可能可以编写一些包装器代码来处理这些差异并将其隔离开来。
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.