文档介绍:第 35 卷
第 12 期
计
算
机
工
程
2009 年 6 月
Computer Engineering
June 2009
·软件技术与数据库·
文章编号:1000—3428(2009)12—0047—03
文献标识码:A
中图分类号:
基于 MDA 的代码生成器设计与实现
杨美荣,史建锋,李明星
(哈尔滨工业大学(威海)管理学院,威海 264209)
摘要:针对如何将业务模型转换为程序代码的问题,提出一种代码生成器设计方案,用以实现模型驱动架构中代码的自动生成。介绍采
用 XML 描述的面向业务对象的平台无关模型,在此基础上设计实现代码生成器,完成从平台无关模型到代码的自动转换,以支持在业务
模型变化后系统行为的快速变化和代码的自动生成,通过实例演示该代码生成器的应用。
关键词:模型驱动架构;平台无关模型;代码生成器
Design and Implementation of Code Generator Based on MDA
YANG Mei-rong, SHI Jian-feng, LI Ming-xing
(School of Management, Harbin Institute of Technology at Weihai, Weihai 264209)
【Abstract】Aiming at the problem that how to transform business model to code, this paper presents a design of code generator to implement code
generated automatically in Model-Driven Architecture(MDA). It introduces a business object-oriented Platform Independent Model(PIM) described
with XML, designs and implements a code generator which realizes the automatic transformation from PIM to code to support rapid changes of
system behaviors and automatic code generation after business model changing. It illustrates the application of the code generator.
【Key words】Model-Driven Architecture(MDA); Platform Independent Model(PIM); code generator
1
概述
代码生成技术是使用程序生成代码的一种技术,它最初
上的 PSM,使用代码生成器自动生成全部或部分特定平台上
的程序代码[4]。在实际应用中,代码生成器也可以直接根据
的用途是把高级语言编译成汇编代码、机器指令,是语言