為不同版本的 3rd 方庫設計實用程序 (Design of utilities for diffrent versions of 3rd party library)


問題描述

為不同版本的 3rd 方庫設計實用程序 (Design of utilities for diffrent versions of 3rd party library)

我繼承了一個應用這種解決方案的項目:

有 5 個版本的 3rd 方庫。解決方案中有 5 個項目,其中包含相應版本的 3rd 方庫的實用程序。

解決方案中的很多實用程序類對於所有版本的 3rd 方庫都有相同的代碼。這樣就解決了重複問題——所有項目需要相同的代碼文件存儲在某個公共文件夾中,並作為鏈接添加到所有項目。

我不覺得使用鏈接共享代碼是最好的方法。您能否告訴我這是否是一種不好的方法,如果是,請告訴我 .resolve 此類代碼重複的正確方法是什麼?

提前致謝。


參考解法

方法 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.

(by ikauser111013)

參考文件

  1. Design of utilities for diffrent versions of 3rd party library (CC BY‑SA 3.0/4.0)

#versioning #code-reuse #.net #libraries #software-design






相關問題

AndroidManifest.xml 文件 <manifest> versionCode 屬性 (AndroidManifest.xml file <manifest> versionCode attribute)

grails 插件兼容性 (grails plugins compatibility)

Debug Unit Test bằng cách sử dụng Resharper 7 cho MBUnit ném ra một ngoại lệ (Debug Unit Tests using Resharper 7 for MBUnit throws an exception)

在 Maven 依賴項中包含不同版本的庫,完全破壞了我的構建 (Including a different version of a library, in a maven dependency totally broke my build)

Servicestack nuget 版本控制 (Servicestack nuget versioning)

如何從共享庫中獲取版本信息到 Android 清單中? (How to get version info from a shared library into the Android manifest?)

我可以在 Visual Studio 中為解決方案設置通用的 major.minor.release (Can I set a general major.minor.release for a solution in Visual Studio)

跨版本的 PowerShell 安裝文件夾和腳本文件擴展名 (PowerShell installation folder and script filename extension across versions)

嚴格版本化的 WCF 服務命名空間是否應該對合同是唯一的? (Should strictly versioned WCF service namespaces be unique to the contract?)

為不同版本的 3rd 方庫設計實用程序 (Design of utilities for diffrent versions of 3rd party library)

如何檢索顯示上游狀態的 git 版本信息 (How do I retrieve git version info showing upstream state)

帶有紗線漿果的 CLI 凹凸版本號 (CLI bump version number with yarn berry)







留言討論