The development of complex software requires tools promoting fail-fast approaches, so that bugs and unexpected behavior can be quickly identified and fixed. Tools for data validation may save the day of computer programmers. In fact, processing invalid data is a waste of resources at best, and a drama at worst if the problem remains unnoticed and wrong results are used for business. Answer Set Programming (ASP) is not an exception, but the quest for better and better performance resulted in systems that essentially do not validate data. Even under the simplistic assumption that input/output data are eventually validated by external tools, invalid data may appear in other portions of the program, and go undetected until some other module of the designed software suddenly breaks. This paper formalizes the problem of data validation for ASP programs, introduces a language to specify data validation, and presents \textsc{valasp}, a tool to inject data validation in ordinary programs. The proposed approach promotes fail-fast techniques at coding time without imposing any lag on the deployed system if data are pretended to be valid. Validation can be specified in terms of statements using YAML, ASP and Python. Additionally, the proposed approach opens the possibility to use ASP for validating data of imperative programming languages. Under consideration for acceptance in TPLP.
翻译:开发复杂的软件需要促进快速失灵方法的工具, 以便快速识别和固定错误和意外行为。 数据验证工具可以节省计算机程序员的一天。 事实上, 处理无效数据充其量只是资源浪费, 如果问题仍然不被注意, 并且对业务使用错误的结果, 处理无效数据是最糟糕的。 回答 Set 编程( ASP) 不是一个例外, 但追求更好和更好的性能导致基本上无法验证数据的系统。 即使在简单假设输入/ 产出数据最终由外部工具验证的情况下, 输入/ 产出数据可能出现在程序的其他部分, 并且无法被检测到, 直到设计软件的某个其他模块突然中断。 本文将ASP 程序的数据验证问题正式化, 引入一种语言来指定数据验证, 并展示 pextsc{ valasp}, 这是普通程序输入数据验证的工具 。 提议的方法促进在时间调算出故障, 而不在数据被假称为有效的情况下对部署的系统造成任何滞后。 校准性数据可以在使用 YAML、 ASP 和 Pyson 程序化数据的可能性。