參考實作

本頁使用了標題或全文手工轉換
維基百科,自由的百科全書

軟件開發過程中,參考實作(英語:Reference implementation,中國大陸作參考實現,台灣作參考實作)是實作對應規範中所有要求的一種電腦程式,也偶爾被稱作參照實裝範例實作(sample implementation)或模型實作(model implementation)。參考實作通常伴隨技術標準,示範了其他任何實作應做到的被視為「正確」的行為。

特徵和例子[編輯]

演算法的參考實作(例如密碼演算法)通常來自標準化流程。在密碼學領域,通常會將原始碼作為公有領域軟件發佈。例如CERN httpd[1]Serpent密碼、base64變種[2]、以及SHA-3[3]Openwall專案英語Openwall Project維護了一個包含多種演算法的在公有領域下發佈的參考實作原始碼名單。[4]

參考實作可能達到或者未達到生產級質素。例如,弗勞恩霍夫協會MP3標準的參考實作通常無法與其他常見的實作(如LAME)在音質測試中相媲美[來源請求]。與之相反,Python程式語言的參考實作CPython則在生產中使用最為廣泛[5]

測試[編輯]

對參考實作進行軟件測試可以提高規範的生產效率:

參考實作通常作為最終解釋一個規範的實作(此定義有些大膽,但一般如此)。在一致性測試套件的開發中,每個介面需要至少一個相對受信任的實作,以做到:(1) 發現規範中的錯誤和歧義,以及(2) 驗證測試套件的功能正確。[6]

參考實作的特徵有:

  1. 與規範和測試套件一同開發;
  2. 驗證規範是可實作的;
  3. 確認測試套件正常工作;
  4. 作為衡量其他實作的金標準;
  5. 一致性測試英語Conformance testing不充分時,有助於闡明規範的意圖[7]

參考文獻[編輯]

  1. ^ The birth of the web Licensing the web on cern.ch (2014)
  2. ^ libb64頁面存檔備份,存於互聯網檔案館) on sourceforge
  3. ^ KeccakReferenceAndOptimized-3.2.zip mainReference.c "The Keccak sponge function, designed by Guido Bertoni, Joan Daemen, Michaël Peeters and Gilles Van Assche. For more information, feedback or questions, please refer to our website: http://keccak.noekeon.org/Implementation[永久失效連結] by the designers, hereby denoted as "the implementer". To the extent possible under law, the implementer has waived all copyright and related or neighboring rights to the source code in this file. https://creativecommons.org/publicdomain/zero/1.0/"存档副本. [2021-01-09]. 原始內容存檔於2013-06-26. 
  4. ^ Source code snippets and frameworks placed in the public domain頁面存檔備份,存於互聯網檔案館) on openwall.info
  5. ^ Snow, Eric. PEP 421 -- Adding sys.implementation. Python.org. Python Software Foundation. 2012-01-26 [2017-01-06]. (原始內容存檔於2017-01-07). For a number of years now, the distinction between Python-the-language and CPython (the reference implementation) has been growing. 
  6. ^ Dalci, Eric; Fong, Elizabeth; Goldfine, Alan (2003). Requirements for GSC-IS Reference Implementations. National Institute of Standards and Technology, Information Technology Laboratory. [https://web.archive.org/web/20060928231404/http://xw2k.sdct.itl.nist.gov/smartcard/document/ref-imp51.pdf Requirements for GSC-IS Reference Implementations]
  7. ^ Curran, Patrick (2003). Conformance Testing: An Industry Perspective. Sun Microsystems. [1]