文章詳目資料

資訊電子學刊

  • 加入收藏
  • 下載文章
篇名 程式中方法命名之研究
卷期 11:1
並列篇名 ON THE METHOD NAME SMELLS OF COMPUTER PROGRAMS
作者 陳文輝翁緯程
頁次 163-173
關鍵字 程式異味方法名稱軟體工程Code SmellMethod NameSoftware Engineering
出刊日期 202307

中文摘要

讓程式具可讀性是程式發展的重要階段。程式異味(Code Smell)是指程式的部分,雖不造成執行的錯誤,卻可能形成未來理解與維護的困難,而清除異味便能增加程式可讀性。程式異味雖在Fowler等學者於1999年提出名詞前,便廣泛存在於工程師經驗中,但將其定義化,卻開啟新學術研究方向[4];在2021年,Jabrayilzade等學者則更主張註解不當,亦造成程式理解困難,而率先定義註解異味(Comment Smell),亦開啟程式可讀性新研究方向[5]。在本論文,我們主張程式方法命名不洽當亦影響程式可讀性,因此在學術上,第一個定義「方法命名異味」(Method Name Smell)之名詞。我們將此異味,依內容或格式之相關性區分兩類,前者延伸註解異味之研究而定義出了誤導式、不相關與模糊性等3種異味;後者則依據Alsuhaibani等學者針對1604個工程師的客觀統計,定義出不一致、文法結構、動詞片語、字典字彙、完全字、縮寫、俚語、前後綴與長度等9種異味[2]。

英文摘要

Code Smell refers to a part of a program that, though not causing errors in its execution, may cause difficulties in understanding and maintaining the program in the future. In the past, code smell research mostly focused on the program structure. In this paper, we first propose the Method Name Smell, claiming that program method names will seriously affect the readability of a program if they are not named properly. Secondly, we divide method name smells into two categories according to their relevance to content or format, and define three smells for the former: Misleading, Irrelevant, and Vague name smells; for the latter, we define Inconsistent, Grammatical Structure, Verb Phrase, Dictionary Term, Full Word, Abbreviation, Slang Word, Prefix/Suffix and Length name smells. The 12 name smells for the method can be extended to other programmatic structures in the future.

相關文獻