在企业管理软件中业务构件可以通过参数化和配置技术被复用以适应业务需求的变化,这种构件粒度大、可变参数多、结构复杂难于开发.为了提高业务构件的开发效率,确保开发正确性,本文提出一种面向大粒度构件,基于模式的构件代码生成方法.从已有应用系统中抽取业务构件的典型软件模式,定义一种支持多种编程语言的模式描述语言,用其构造基于模式的非实例化构件,并采用模型驱动的思想,将对应模式下富含业务语义的构件实现模型转换为目标程序,以实现业务构件的自动生成.在此方法指导下,开发一套可视化建模与代码生成工具组,并利用此工具自动生成了运行在J2EE平台上的采购管理系统中部分业务构件,应用结果验证了本方法的有效性和实用性.
The business component is reused to adapt requirement changes by parametrization and configuration in large scale software for enterprise,but it is developed difficulty because of the large granularity,various parameters and complexity of the structure.This paper presents a pattern based code generation method for the large-grained component to improve the efficiency and correctness of development.A specific formal pattern description language is defined to describe the typical software patterns abstracted from the existing components programmed with multiple programming languages. A code generation algorithm is proposed to transform component models for business semantics into target program based on these patterns. The visualization modeling tool and code generator have been developed to generate automatically business components based on J2EE platform. Result of a case purchase system shows effectiveness of this method.