Publications-Theses
Article View/Open
Publication Export
-
Google ScholarTM
NCCU Library
Citation Infomation
Related Publications in TAIR
題名 基於CKJM-DI 指標分析依賴注入實現方式對軟體可維護性的影響
Impact of Dependency Injection on Software Maintainability Based on CKJM-DI作者 林均儕
Lin, Jun-Chai貢獻者 廖峻鋒<br>許志堅
林均儕
Lin, Jun-Chai關鍵詞 依賴注入
軟體品質指標
可維護性日期 2025 上傳時間 1-Jul-2025 14:01:29 (UTC+8) 摘要 隨著資訊技術的快速發展,軟體系統架構也變得日益複雜。程式碼量的增 加以及模組間的緊密耦合,讓軟體架構的維護與擴展變得更加困難。為了解決 這些挑戰,控制反轉(Inversion of Control, IoC)技術應運而生。IoC 的核心理 念是將物件的控制權從內部轉交給外部框架來管理,以減少模組間的依賴關係 並提升架構的靈活性。其中,依賴注入(Dependency Injection, DI)作為 IoC 的 主要實踐方式,通過外部實體動態提供物件所需的依賴,使物件無需直接管理 這些依賴,從而降低模組耦合度,並促進軟體架構的模組化設計。而 Spring Framework 即是目前業界最廣泛使用的 Java 依賴注入框架。 然而,依賴注入雖然提升了軟體架構的靈活性與可維護性,但其不當使用 可能引發一系列反模式(Anti-Pattern)。例如,過度依賴注入可能導致耦合度增 加,或將依賴隱藏於框架內部,使得對 DI 框架(如 Spring Framework)理解不 足的開發者面臨更高的維護成本,進而累積技術債。 軟體品質始終是開發社群關注的重要議題,而具備良好可維護性與可測試 性的架構設計,是開發者追求的目標之一。儘管軟體品質的定義已相對清晰, 但衡量這些品質的工具卻十分有限。因此,本研究開發出軟體品質指標計算工 具 CKJM-DI 及 XML-DI,用以量化軟體品質指標,並藉指標數值比較使用與未 使用依賴注入,以及不同依賴注入實現方式對軟體可維護性的影響。 本研究透過實驗進行了對指標數據的分析,驗證出使用依賴注入相較於不 使用依賴注入時更可以提升軟體可維護性,也提供了三種不同依賴注入實現方 式各自的好處與影響供開發人員做選擇。最後,也將 CKJM-DI 與 CKJM 原版相 比,證明了 CKJM-DI 更適合應用於依賴注入場景。 參考文獻 [1] Spinellis, D. (2005). Tool writing: A forgotten art? IEEE Software, 22(4), 9–11. https://doi.org/10.1109/MS.2005.111 [2] Chidamber, S. R., & Kemerer, C. F. (1994). A metrics suite for object-oriented design. IEEE Transactions on Software Engineering, 20(6), 476–493. https://doi.org/10.1109/32.295895 [3] Fowler, M. (2004, January 23). Inversion of control containers and the dependency injection pattern. Martin Fowler. https://www.martinfowler.com/articles/injection.html [4] Sobernig, S., & Zdun, U. (2010, July). Inversion-of-Control layer. In Proceedings of the 15th European Conference on Pattern Languages of Programs (EuroPLoP), Irsee, Bavaria, Germany. Association for Computing Machinery. https://doi.org/10.1145/2328909.2328935 [5] Roubtsov, S., Serebrenik, A., & van den Brand, M. (2010). Detecting modularity "smells" in dependencies injected with Java annotations. In Proceedings of the 14th European Conference on Software Maintenance and Reengineering (pp. 244-247). IEEE. https://doi.org/10.1109/CSMR.2010.45 [6] Yang, H. Y., Tempero, E., & Melton, H. (2008). An empirical study into the use of dependency injection in Java. In 19th Australian Conference on Software Engineering (ASWEC), 239-247. IEEE. https://doi.org/10.1109/ASWEC.2008.4483212 [7] R. C. Martin. The Dependency Inversion Principle. C++ Report, 8(6):61–66, June 1996. [8] Chen, M., Tu, T., Zhang, H., Wen, Q., & Wang, W. (2022). Jasmine: A static analysis framework for Spring core technologies. In 37th IEEE/ACM International Conference on Automated Software Engineering (ASE), October 10-14, 2022, Rochester, MI, USA. ACM. https://doi.org/10.1145/3551349.3556910 [9] Hundsdorfer, S., Elsner, D., & Pretschner, A. (2023). DIRTS: Dependency Injection Aware Regression Test Selection. In 2023 IEEE Conference on Software Testing, Verification and Validation (ICST), 422-432. IEEE. https://doi.org/10.1109/ICST57152.2023.00046 [10] Laigner, R., Kalinowski, M., Carvalho, L., Mendonça, D., & Garcia, A. (2019). Towards a catalog of Java dependency injection anti-patterns. In Proceedings of the XXXIII Brazilian Symposium on Software Engineering (SBES 2019), Salvador, Brazil (pp. 10 pages). Association for Computing Machinery. https://doi.org/10.1145/3350768.3350771 [11] Qureshi, M. H., & Samadzadeh, M. H. (2005). Determining the complexity of XML documents. Proceedings of the International Conference on Information Technology: Coding and Computing (ITCC’05). IEEE. https://doi.org/10.1109/ITCC.2005.126 [12] McDowell, A., Schmidt, C., & Yue, K. (2004). Analysis and metrics of XML Schema. In Proceedings of the 2004 International Conference on Software Engineering Research and Practice (pp. 538–544). Las Vegas, NV. [13] Chawla, M. K., & Chhabra, I. (2015). SQMMA: Software Quality Model for Maintainability Analysis. Proceedings of Compute 2015, October 29-31, Ghaziabad, India. Association for Computing Machinery. https://doi.org/10.1145/2835043.2835062 [14] R. Nambiar, “Java petstore: A case study,” Ph.D. dissertation, Kansas State University, 2005. [15] A. Shatnawi, H. Mili, G. El Boussaidi, A. Boubaker, Y.-G. Guéhéneuc, N. Moha, J. Privat, and M. Abdellatif, “Analyzing program dependencies in java ee applications,” in 2017 IEEE/ACM 14th International Conference on Mining Software Repositories (MSR). IEEE, 2017, pp. 64–74. https://doi.org/10.1109/MSR.2017.6 [16] ISO. (2011). ISO/IEC 25010:2011. Systems and software engineering—Systems and software Quality Requirements and Evaluation (SQuaRE)—System and software quality models. International Organization for Standardization. [17] Cai, Y., & Sullivan, K. (2006). Modularity analysis of logical design models. In 21st IEEE International Conference on Automated Software Engineering (ASE) (pp. 199–208). IEEE. https://doi.org/10.1109/ASE.2006.53 [18] Sun, C.-W., & Liao, C.-F. (2023). Examining the influence of dependency injection on software maintainability. In Proceedings of the 8th IEEE International Conference on Big Data, Cloud Computing, and Data Science (BCD) (pp. 250–255). IEEE. https://doi.org/10.1109/BCD57833.2023.10466290 描述 碩士
國立政治大學
數位內容碩士學位學程
112462011資料來源 http://thesis.lib.nccu.edu.tw/record/#G0112462011 資料類型 thesis dc.contributor.advisor 廖峻鋒<br>許志堅 zh_TW dc.contributor.author (Authors) 林均儕 zh_TW dc.contributor.author (Authors) Lin, Jun-Chai en_US dc.creator (作者) 林均儕 zh_TW dc.creator (作者) Lin, Jun-Chai en_US dc.date (日期) 2025 en_US dc.date.accessioned 1-Jul-2025 14:01:29 (UTC+8) - dc.date.available 1-Jul-2025 14:01:29 (UTC+8) - dc.date.issued (上傳時間) 1-Jul-2025 14:01:29 (UTC+8) - dc.identifier (Other Identifiers) G0112462011 en_US dc.identifier.uri (URI) https://nccur.lib.nccu.edu.tw/handle/140.119/157629 - dc.description (描述) 碩士 zh_TW dc.description (描述) 國立政治大學 zh_TW dc.description (描述) 數位內容碩士學位學程 zh_TW dc.description (描述) 112462011 zh_TW dc.description.abstract (摘要) 隨著資訊技術的快速發展,軟體系統架構也變得日益複雜。程式碼量的增 加以及模組間的緊密耦合,讓軟體架構的維護與擴展變得更加困難。為了解決 這些挑戰,控制反轉(Inversion of Control, IoC)技術應運而生。IoC 的核心理 念是將物件的控制權從內部轉交給外部框架來管理,以減少模組間的依賴關係 並提升架構的靈活性。其中,依賴注入(Dependency Injection, DI)作為 IoC 的 主要實踐方式,通過外部實體動態提供物件所需的依賴,使物件無需直接管理 這些依賴,從而降低模組耦合度,並促進軟體架構的模組化設計。而 Spring Framework 即是目前業界最廣泛使用的 Java 依賴注入框架。 然而,依賴注入雖然提升了軟體架構的靈活性與可維護性,但其不當使用 可能引發一系列反模式(Anti-Pattern)。例如,過度依賴注入可能導致耦合度增 加,或將依賴隱藏於框架內部,使得對 DI 框架(如 Spring Framework)理解不 足的開發者面臨更高的維護成本,進而累積技術債。 軟體品質始終是開發社群關注的重要議題,而具備良好可維護性與可測試 性的架構設計,是開發者追求的目標之一。儘管軟體品質的定義已相對清晰, 但衡量這些品質的工具卻十分有限。因此,本研究開發出軟體品質指標計算工 具 CKJM-DI 及 XML-DI,用以量化軟體品質指標,並藉指標數值比較使用與未 使用依賴注入,以及不同依賴注入實現方式對軟體可維護性的影響。 本研究透過實驗進行了對指標數據的分析,驗證出使用依賴注入相較於不 使用依賴注入時更可以提升軟體可維護性,也提供了三種不同依賴注入實現方 式各自的好處與影響供開發人員做選擇。最後,也將 CKJM-DI 與 CKJM 原版相 比,證明了 CKJM-DI 更適合應用於依賴注入場景。 zh_TW dc.description.tableofcontents 謝辭 ii 摘要 iii 目錄 iv 圖目錄 vi 表目錄 viii 第一章 緒論 1 第一節 研究背景與動機 1 第二節 研究目的與問題 5 第三節 預期貢獻和研究流程 6 第二章 技術背景與文獻探討 8 第一節 依賴注入(Dependency Injection) 8 第二節 Bean 的配置方式與注入方式 12 第三節 依賴注入的反模式(Anti-Pattern) 18 第四節 XML 可維護性的量化指標 19 第五節 相關研究 19 第三章 系統設計 21 第一節 發展適用於依賴注入的可維護性量化指標 21 第二節 發展適用於 XML 的可維護性量化指標 25 第三節 發展指標測試基準(Benchmark) 28 第四章 評估與討論 35 第一節 以 CKJM-DI 分析使用依賴注入前後影響 35 第二節 以 CKJM-DI、XML-DI 分析依賴注入不同實現方式 44 第三節 評估 CKJM-DI 與 CKJM-Original 差異 49 第四節 研究問題討論 56 第五章 結論 59 參考文獻 61 zh_TW dc.format.extent 2823505 bytes - dc.format.mimetype application/pdf - dc.source.uri (資料來源) http://thesis.lib.nccu.edu.tw/record/#G0112462011 en_US dc.subject (關鍵詞) 依賴注入 zh_TW dc.subject (關鍵詞) 軟體品質指標 zh_TW dc.subject (關鍵詞) 可維護性 zh_TW dc.title (題名) 基於CKJM-DI 指標分析依賴注入實現方式對軟體可維護性的影響 zh_TW dc.title (題名) Impact of Dependency Injection on Software Maintainability Based on CKJM-DI en_US dc.type (資料類型) thesis en_US dc.relation.reference (參考文獻) [1] Spinellis, D. (2005). Tool writing: A forgotten art? IEEE Software, 22(4), 9–11. https://doi.org/10.1109/MS.2005.111 [2] Chidamber, S. R., & Kemerer, C. F. (1994). A metrics suite for object-oriented design. IEEE Transactions on Software Engineering, 20(6), 476–493. https://doi.org/10.1109/32.295895 [3] Fowler, M. (2004, January 23). Inversion of control containers and the dependency injection pattern. Martin Fowler. https://www.martinfowler.com/articles/injection.html [4] Sobernig, S., & Zdun, U. (2010, July). Inversion-of-Control layer. In Proceedings of the 15th European Conference on Pattern Languages of Programs (EuroPLoP), Irsee, Bavaria, Germany. Association for Computing Machinery. https://doi.org/10.1145/2328909.2328935 [5] Roubtsov, S., Serebrenik, A., & van den Brand, M. (2010). Detecting modularity "smells" in dependencies injected with Java annotations. In Proceedings of the 14th European Conference on Software Maintenance and Reengineering (pp. 244-247). IEEE. https://doi.org/10.1109/CSMR.2010.45 [6] Yang, H. Y., Tempero, E., & Melton, H. (2008). An empirical study into the use of dependency injection in Java. In 19th Australian Conference on Software Engineering (ASWEC), 239-247. IEEE. https://doi.org/10.1109/ASWEC.2008.4483212 [7] R. C. Martin. The Dependency Inversion Principle. C++ Report, 8(6):61–66, June 1996. [8] Chen, M., Tu, T., Zhang, H., Wen, Q., & Wang, W. (2022). Jasmine: A static analysis framework for Spring core technologies. In 37th IEEE/ACM International Conference on Automated Software Engineering (ASE), October 10-14, 2022, Rochester, MI, USA. ACM. https://doi.org/10.1145/3551349.3556910 [9] Hundsdorfer, S., Elsner, D., & Pretschner, A. (2023). DIRTS: Dependency Injection Aware Regression Test Selection. In 2023 IEEE Conference on Software Testing, Verification and Validation (ICST), 422-432. IEEE. https://doi.org/10.1109/ICST57152.2023.00046 [10] Laigner, R., Kalinowski, M., Carvalho, L., Mendonça, D., & Garcia, A. (2019). Towards a catalog of Java dependency injection anti-patterns. In Proceedings of the XXXIII Brazilian Symposium on Software Engineering (SBES 2019), Salvador, Brazil (pp. 10 pages). Association for Computing Machinery. https://doi.org/10.1145/3350768.3350771 [11] Qureshi, M. H., & Samadzadeh, M. H. (2005). Determining the complexity of XML documents. Proceedings of the International Conference on Information Technology: Coding and Computing (ITCC’05). IEEE. https://doi.org/10.1109/ITCC.2005.126 [12] McDowell, A., Schmidt, C., & Yue, K. (2004). Analysis and metrics of XML Schema. In Proceedings of the 2004 International Conference on Software Engineering Research and Practice (pp. 538–544). Las Vegas, NV. [13] Chawla, M. K., & Chhabra, I. (2015). SQMMA: Software Quality Model for Maintainability Analysis. Proceedings of Compute 2015, October 29-31, Ghaziabad, India. Association for Computing Machinery. https://doi.org/10.1145/2835043.2835062 [14] R. Nambiar, “Java petstore: A case study,” Ph.D. dissertation, Kansas State University, 2005. [15] A. Shatnawi, H. Mili, G. El Boussaidi, A. Boubaker, Y.-G. Guéhéneuc, N. Moha, J. Privat, and M. Abdellatif, “Analyzing program dependencies in java ee applications,” in 2017 IEEE/ACM 14th International Conference on Mining Software Repositories (MSR). IEEE, 2017, pp. 64–74. https://doi.org/10.1109/MSR.2017.6 [16] ISO. (2011). ISO/IEC 25010:2011. Systems and software engineering—Systems and software Quality Requirements and Evaluation (SQuaRE)—System and software quality models. International Organization for Standardization. [17] Cai, Y., & Sullivan, K. (2006). Modularity analysis of logical design models. In 21st IEEE International Conference on Automated Software Engineering (ASE) (pp. 199–208). IEEE. https://doi.org/10.1109/ASE.2006.53 [18] Sun, C.-W., & Liao, C.-F. (2023). Examining the influence of dependency injection on software maintainability. In Proceedings of the 8th IEEE International Conference on Big Data, Cloud Computing, and Data Science (BCD) (pp. 250–255). IEEE. https://doi.org/10.1109/BCD57833.2023.10466290 zh_TW
