軟體缺陷指標

軟體缺陷指標(Software Defect Indicator)是源代码中會出現的一些模式,和程序错误有強烈的相關性,程序错误是指程式碼中有錯誤或是遺漏程式,會因此造成程式的動作異常。在檢視计算机程序時,不一定每次都可以直接識別到程式的錯誤,但因為軟體缺陷指標有固定的型式(有時也稱為反面模式代碼異味),表示程式有可能有問題。

以下是一些軟體缺陷指標的例子:

  • 無效不會執行的程式:已撰寫好的程式碼,而程式設計者刻意關閉程式不執行,也沒有相關註解說明此程式為何要關閉,或是這程式何時會恢復執行的資訊。
  • 函式太過複雜:程式(方法、模組、副程式、函式、子函式、程序,或是任何有名稱的一塊程式碼)中包括了十個條件敘述中的邏輯判斷式[1]
  • 沒用到的變數:沒有參考到的變數意味著可能有其他的錯誤[2]
  • 軟體提交者的數量:是指專案提交(commit)歷史上有貢獻開發者的個數。這是流程指標,對於指出軟體缺陷很有幫助 [3]

相關條目 编辑

參考資料 编辑

  1. ^ William T. Ward: "Software Defect Prevention Using McCabe's Complexity Metric", Hewlett-Packard Journal, April 1989, pp 64-69: Control-flow complexity has been correlated with low reliability and frequent errors.
  2. ^ David N. Card, Victor E. Church, and William W. Agresti: "An Empirical Study of Software Design Practices", IEEE Transactions on Software Engineering, SE-12, no. 2, February 1986, pp 264-71: 46 percent of routines with no unused variables had no errors compared to only 17 to 29 percent for those with one or more unreferenced variables.
  3. ^ Madeyski, Lech, and Marian Jureczko. “Which Process Metrics Can Significantly Improve Defect Prediction Models? An Empirical Study.” Software Quality Journal 23.3 (2015): 393–422. Web.

外部連結 编辑