节点文献

基于DSL的一种数据合法性校验框架的设计与实现

Design and Implementation of a Data Validation Framework Based on DSL

【作者】 王巍

【导师】 杨贵福;

【作者基本信息】 东北师范大学 , 软件工程, 2018, 硕士

【摘要】 在软件开发中,数据的合法性校验占据着十分重要的位置。数据合法性校验的好坏从软件产品的安全性、用户体验、可维护性以及健壮性等方面影响着软件产品的质量,是软件产品一个不可或缺的功能。本文在对一个电化学工作站系统进行参数校验即数据合法性校验重构的背景下,设计并实现了一种基于DSL的数据合法性校验框架。设计的校验框架与语言无关,支持对数据的范围和数据间依赖关系的合法性校验。框架采用基于DSL的可变性建模技术,对数据合法性校验的可变性与共性进行分析,构建元模型。基于元模型,使用DSL表达可变性部分,StringTemplate模板表述共性部分,使用DSL工具ANTLR和StringTemplate实现校验代码生成器。最后,在元模型的约束下,编写元模型实例,使用校验代码生成器,生成全部校验部分的代码。使用设计的校验框架完成了电化学工作站系统的80多个电化学实验的参数校验重构工作,框架将参数校验逻辑与业务逻辑之间进行了分离,将应用系统中的数据校验部分抽取出来,降低了数据校验在应用系统中的耦合度,降低了数据校验在系统中的维护难度。框架采用了统一规范的校验方式,使用相同的元模型文件、模板文件,无需多次编写重复的校验代码,提高了数据校验的可复用性。除此之外,设计的校验框架可以通过模板支持多种语言,为其他有多语言实现需求的项目提供借鉴。

【Abstract】 In software development,the validity of input data occupies a very important position.The quality of data validation affects the quality of software products in many dimensions,such as,security of software products,user experience,maintainability,and robustness.It is a function that must be implemented in software development.In the background of the reconfiguration of experimental parameters validation for an electrochemical workstation system,we designed and implemented a data validation framework based on DSL.Our validation framework is language-independent,and supports validity checking for data ranges and dependencies between data.The framework takes variable modeling technology based on DSL to analyze the variability and commonality of data legality,and then builds a metamodel.Based on the metamodel,using DSL to express variability,StringTemplate to express commonality,and then using the DSL tool ANTLR and StringTemplate to implement code generator of data validation.Finally,under the constraint of the metamodel,we design metamodel instances,then use the metamodel instances and code generator to generate all the source code for the checkout part.We have completed the refactoring of parameter validation of more than 80 electrochemical experiments in an electrochemical workstation system using this framework.The framework separates the parameter validation from the business logic,extracts the data validation from the application system,which lower coupling system,reduce maintenance difficulty of data validation in the system.The framework adopts a unified and standard validation mode,uses a same metamodel file and template file to avoid writing repeated validation codes many times,which improves the reusability of data validation.In addition,our validation framework can support multiple languages through template,providing reference for other projects with multi language requirements.

节点文献中: 

本文链接的文献网络图示:

本文的引文网络