跳到主要內容

簡易檢索 / 詳目顯示

研究生: 曾培源
Pei-Yuan Zeng
論文名稱: Time capsules of code: 使用穿越時空的訊息來解決程式碼 註解的弊病
指導教授: 鄭永斌
Yung-Pin Cheng
口試委員:
學位類別: 碩士
Master
系所名稱: 資訊電機學院 - 軟體工程研究所
Graduate Institute of Software Engineering
論文出版年: 2024
畢業學年度: 112
語文別: 中文
論文頁數: 63
中文關鍵詞: 穿越時空的訊息程式碼註解註解一致性註解的時效性
相關次數: 點閱:11下載:0
分享至:
查詢本校圖書館目錄 查詢臺灣博碩士論文知識加值系統 勘誤回報
  • 在軟體開發過程中,程式開發者經常因為開發需求而遺漏或未更 新註解,導致程式碼與註解不一致。此外,隨著程式碼的頻繁變動, 因為註解具有時效性的問題,造成註解的歷史在最新版本的程式碼中 難以的完整被保留,然而這對未來的軟體維護至關重要。
    傳統的程式碼註解方式存在諸多缺陷,例如無法留下長訊息、無 法支援多媒體註解,或是難以追蹤程式碼和註解的改動歷史等等的問 題。針對這些問題,本論文提出了一種名為 Message Box 的擴展自 GeekyNote 標籤系統工具,旨在通過自動化整合歷史訊息和結合 Git 訊息的方式,提供程式碼變更歷史追蹤和管理,以解決程式碼與註解 的一致性問題,並且能夠整合多種訊息以及儲存 HTML 標記、圖片、 影音等資料,使得訊息呈現更具可讀性。此外,Message Box 也透過 結合 Git 時間軸資料,補足註解的時效性問題,避免過去的訊息在最 新版本專案中消失。
    Message Box 的設計和實現展示了一種新的程式碼與註解歷史變 動管理方式,有效提升了軟體開發的效率和程式碼的可維護性,減少 了註解與程式碼不一致與時效性的風險,提供了詳細的變更歷史記錄, 便於開發者進行追溯和理解。


    In the software development process, developers often fail to update comments due to development needs, leading to inconsistencies between code and comments. Additionally, with frequent code changes, the temporal nature of comments causes the history of comments to be difficult to retain completely in the latest version of the code, which is crucial for future software maintenance.
    Traditional code commenting methods have many drawbacks, such as the inability to leave long messages, lack of support for multimedia comments, and difficulty in tracking changes to code and comments. To address these issues, this thesis proposes a tool named Message Box, an extension of the GeekyNote tagging system, aimed at automatically integrating historical information and combining Git messages to provide code change history tracking and management. This tool resolves the consistency issues between code and comments, and can integrate various types of information as well as store HTML tags, images, videos, and other data, making the presentation of information more readable. Additionally, by incorporating Git timeline data, Message Box addresses the temporal nature of comments, preventing past information from disappearing in the latest project versions.
    The design and implementation of Message Box demonstrate a new way to manage the historical changes of code and comments, significantly improving software development efficiency and code maintainability. It reduces the risk of inconsistencies and obsolescence of comments, provides detailed change history records, and facilitates developers in tracing and understanding changes.

    摘要 i Abstract ii 目錄 iii 圖目錄 vi 表目錄 viii 一、 緒論 1 二、 研究背景與相關技術 6 2-1 程式碼註解的缺陷 6 2-2 避免註解的缺漏 7 2-3 避免對註解反覆修改 8 2-4 保持程式碼與註解的一致性 9 2-5 History Label in GeekyNote 10 2-6 技術文件的知識傳承 12 三、 問題描述與分析 14 3-1 穿越時空的訊息有什麼意義? 14 3-1-1 傳統註解的問題 15 3-1-2 快速檢閱過去版本的改動 15 3-1-3 提供實用和關鍵的系統架構或邏輯知識 16 3-1-4 加快開發者修復程式碼錯誤的速度 16 3-1-5 防止不正確更改程式碼 16 3-2 什麼是穿越時空的訊息- Message Box? 17 3-3 穿越時空、時空膠囊適用於哪些訊息種類 20 3-4 Message Box的理念與應用 21 四、 Message Box架構與設計 25 4-1 Message Box設計架構 25 4-1-1 Label的擴充 26 4-1-2 Message Page 26 4-1-3 Commit版本時間軸 29 4-2 Function-Base Message Page 30 4-2-1 功能特點 31 4-2-2 適用場景 32 4-2-3 實現方式 32 4-2-4 如何與程式碼做關聯 34 4-3 Select-Base Message Page 34 4-3-1 功能特點 35 4-3-2 適用場景 36 4-3-3 實現方式 37 4-4 Message Box使用案例 38 五、 討論與評估 40 5-1 Message Box與傳統註解 40 5-2 Message Box與一般文件的差異 41 5-3 軟體開發上的效率提升 42 六、 結論與未來展望 44 6-1 追溯訊息的重要性 44 6-2 軟體開發中的適用性 44 6-3 實務上的分析 45 6-4 未來研究 46 七、 參考資料 49

    [1] Y. -P. Cheng, W. -N. Hsiung, Y. -S. Wu and L. -H. Chen, "GeekyNote: A Technical Documentation Tool with Coverage, Backtracking, Traces, and Couplings," 2020 IEEE/ACM 42nd International Conference on Software Engineering: Companion Proceedings (ICSE-Companion), Seoul, Korea (South), 2020, pp. 73-76.
    [2] E. Aghajani et al., "Software Documentation Issues Unveiled," 2019 IEEE/ACM 41st International Conference on Software Engineering (ICSE), Montreal, QC, Canada, 2019, pp. 1199-1210, doi: 10.1109/ICSE.2019.00122.
    [3] S. Haiduc, J. Aponte, L. Moreno and A. Marcus, "On the Use of Automated Text Summarization Techniques for Summarizing Source Code," 2010 17th Working Conference on Reverse Engineering, Beverly, MA, USA, 2010, pp. 35-44, doi: 10.1109/WCRE.2010.13.
    [4] L. Moreno, J. Aponte, G. Sridhara, A. Marcus, L. Pollock and K. Vijay-Shanker, "Automatic generation of natural language summaries for Java classes," 2013 21st International Conference on Program Comprehension (ICPC), San Francisco, CA, USA, 2013, pp. 23-32, doi: 10.1109/ICPC.2013.6613830.
    [5] S. H. Tan, D. Marinov, L. Tan and G. T. Leavens, "@tComment: Testing Javadoc Comments to Detect Comment-Code Inconsistencies," 2012 IEEE Fifth International Conference on Software Testing, Verification and Validation, Montreal, QC, Canada, 2012, pp. 260-269, doi: 10.1109/ICST.2012.106.
    [6] Tan L, Yuan D, Krishna G, et al. 2007. iComment: Bugs or bad comments? ACM SIGOPS Operating Systems Review. ACM, 41(6): 145–158.
    [7] “Git Commit” [Online]. Available: https://www.git-scm.com/docs/git-commit. [Accessed 12 6 2024]
    [8] D. Steidl, B. Hummel and E. Juergens, "Quality analysis of source code comments," 2013 21st International Conference on Program Comprehension (ICPC), San Francisco, CA, USA, 2013, pp. 83-92, doi: 10.1109/ICPC.2013.6613836.
    [9] P. Chatterjee, B. Gause, H. Hedinger and L. Pollock, "Extracting Code Segments and Their Descriptions from Research Articles," 2017 IEEE/ACM 14th International Conference on Mining Software Repositories (MSR), Buenos Aires, Argentina, 2017, pp. 91-101, doi: 10.1109/MSR.2017.10.
    [10] B. Yang, Z. Liping and Z. Fengrong, "A Survey on Research of Code Comment" in Proceedings of the 2019 3rd International Conference on Management Engineering Software Engineering and Service Sciences(ICMSS 2019), New York, NY, USA:Association for Computing Machinery, pp. 45-51.
    [11] X. Song, H. Sun, X. Wang and J. Yan, "A Survey of Automatic Generation of Source Code Comments: Algorithms and Techniques," in IEEE Access, vol. 7, pp. 111411-111428, 2019, doi: 10.1109/ACCESS.2019.2931579.
    [12] C. Zhang, J. Wang, Q. Zhou, T. Xu, K. Tang, H. Gui, et al., "A survey of automatic source code summarization", Symmetry, vol. 14, no. 3, pp. 471, 2022.
    [13] X. Xia, L. Bao, D. Lo, Z. Xing, A. E. Hassan and S. Li, "Measuring Program Comprehension: A Large-Scale Field Study with Professionals," in IEEE Transactions on Software Engineering, vol. 44, no. 10, pp. 951-976, 1 Oct. 2018, doi: 10.1109/TSE.2017.2734091.
    [14] A. J. Ko, et al., “An exploratory study of how developers seek, relate, and collect relevant information during software maintenance tasks,” IEEE Trans. Softw. Eng., vol. 32, no. 12, pp. 971–987, Dec. 2006.
    [15] R. Minelli, A. Mocci, and M. Lanza, “I know what you did last summer—an investigation of how developers spend their time,” in Proc. 23rd IEEE Int. Conf. Program Comprehension, 2015, pp. 25–35.
    [16] “Code Commenting: Common Mistakes and Their Solutions and Tools!” [Online]. Available: https://www.linkedin.com/pulse/code-commenting-common-mistakes-solutions-tools-knowlio/. [Accessed 12 6 2024]
    [17] “Best practices for writing code comments” [Online]. Available: https://stackoverflow.blog/2021/12/23/best-practices-for-writing-code-comments/. [Accessed 12 6 2024]
    [18] “MongoDB” [Online]. Available: https://www.mongodb.com/. [Accessed 12 6 2024]
    [19] “Gitamine” [Online]. Available: https://github.com/pvigier/gitamine [Accessed 12 6 2024]
    [20] “Levenshtein distance” [Online] Available: https://en.wikipedia.org/wiki/Levenshtein_distance [Accessed 12 6 2024]
    [21] “VSCode” [Online] Available: https://code.visualstudio.com/docs [Accessed 29 6 2024]

    QR CODE
    :::