参考实现

软件开发过程中,(英語:Reference implementation,是实现对应规范中所有要求的一种计算机程序,也偶尔被称作參照實裝示例实现(sample implementation)或模型实现(model implementation)。参考实现通常伴随技术标准,了其他任何实现应做到的被视为“正确”的行为。

特征和例子

算法的参考实现(例如密码算法)通常来自标准化流程。在密码学领域,通常会将源代码作为公有领域软件发布。例如CERN httpd[1]Serpent密码、base64变种[2]、以及SHA-3[3]Openwall项目维护了一个包含多种算法的在公有领域下发布的参考实现源代码名单。[4]

参考实现可能达到或者未达到生产级质量。例如,弗劳恩霍夫协会MP3标准的参考实现通常无法与其他常见的实现(如LAME)在音质测试中相媲美。与之相反,Python编程语言的参考实现CPython则在生产中使用最为广泛[5]

测试

对参考实现进行软件测试可以提高规范的生产效率:

参考实现通常作为最终解释一个规范的实现(此定义有些大胆,但一般如此)。在一致性测试套件的开发中,每个接口需要至少一个相对受信任的实现,以做到:(1) 发现规范中的错误和歧义,以及(2) 验证测试套件的功能正确。[6]

参考实现的特征有:

  1. 与规范和测试套件一同开发;
  2. 验证规范是可实现的;
  3. 确认测试套件正常工作;
  4. 作为衡量其他实现的金标准;
  5. 一致性测试不充分时,有助于阐明规范的意图[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%5B%5D 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. . 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.
This article is issued from Wikipedia. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.