參考實作

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

軟件開發過程中,參考實作(英語: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]