Model Driven Architecture(2)
The OMG turned its attention from Common Object Request Broker Architecture to MDA with a white paper in 2000, beginning an effort at classification and standardization and in the process producing a new lexicon, including core notions of the platform-independent model (PIM), platform-specific model (PSM) and Meta-Object Facility (MOF).
UML has a role in MDA, but models do not have to be created in UML to conform to the OMG’s MDA. Instead, both text-based and graphical languages must conform to MOF, which could be called a kind of mother language. (However, it’s hard to say what came first; MOF was abstracted from UML, and UML is one of MOF’s best examples.) MOF is general and universal enough that the disparate companies that make up the OMG do not have to agree to use the same modeling languages. They only have to agree to follow the same principles.
After requirements analysis, modeling in MDA begins with PIMs. These models are meant to capture an algorithm but to ignore the computer hardware and software that will be used to implement them. The models are intended to be pure expressions of the algorithm, with the best division between design and implementation possible.
PIMs are translated into PSMs in the next stage, “compilation,” in which the algorithms are made more ready to run. PSMs have features that correspond to the capabilities of hardware and software. In addition, PIMs may have been“marked” to facilitate this transformation. Finally, PSMs are translated into actual code, which will run on actual hardware, or on actual middleware on actual hardware.
2. Automated Code
The vision behind MDA is to automate as much of the process of code generation as possible, leaving designers to focus on the algorithm instead. Using tools and languages that will make the design as good as possible, the implementation will come later and will have as little of the pesky interference of fallible humans as possible.
If the underlying hardware or operating system is changed, the model is simply "recompiled" or "retranslated" to work on the new system. If maintenance is required, the model serves as an accurate document of how the algorithm works, and only the model needs to be maintained. The idea is that implementation and coding errors will be minimized.
Fear that this process will produce inefficient code is similar to the reaction when the compilation of third- generation languages was compared to the direct writing of assembly code, which generated a fear that in many cases proved to be unfounded.
The OMG lists several large projects on its Web site that have successfully used automated MDA to produce efficient, successful code with fewer resources than would have been used in more traditional projects. These include work done for Wisconsin's Department of Workforce Development, Postgirot Bank AB, Looking Glass Networks Inc., Credit Suisse Group and others.
(The end)
模型驱动的体系结构(2)
在2000年的一份白皮书中,OMG将其注意力从“公共对象请求代理体系结构”转向MDA,开始了分类和标准化的研究,在这个过程中产生了新的专用词汇,如独立于平台的模型(PIM)、特定平台的模型(PSM)和元对象功能(MOF)等核心概念。
UML在MDA中起作用,但不一定非要用UML建立模型来符合OMG的MDA。相反,基于文本和图形的语言必须符合MOF,这可以叫做一种母语言(但是,很难说哪个先有,MOF是从UML中抽象出来的,UML是MOF最好例子之一)。MOF非常通用、万能,以至于组成OMG的不同公司不必同意使用相同的建模语言。它们只是必须同意遵循相同的原则。
在需求分析之后,用MDA建模与PIM同时开始。这些模型意味着俘获了一个算法但忽略了实现它们的计算机硬件和软件。模型更像算法的纯表达式,是设计和可能的实现之间的最佳分割。
下一步,PIM会被翻译成PSM,即“编译”,在此过程中,使算法更多地做好运行的准备。PSM拥有与软硬件的功能相对应的特性,而且,为了方便这个转化,PIM事先已经被做了“标记”。最后,PSM翻译被成实际代码,它将在实际的硬件上运行或者在实际硬件的中间件上运行。
2. 自动编写代码
MDA背后的愿景就是尽可能多地使代码生成的过程自动化,让设计师集中在算法上。利用那些能使设计尽可能好的工具和语言,以后实现时尽可能少地让易出错的人类干预。
如果基础的硬件或操作系统变了,模型只是简单地重新编译或重新转换,就能在新系统上工作。如果需要维护,模型起到了实际文档的作用,说明算法是如何工作的,而且只有模型需要维护。这个设想使实现和编码错误减至最少。
对这个过程会产生低效代码的担忧,与把第三代语言的编译与直接手工编写汇编码进行比较时的反应相似,业已证明,这种担心在大多数情况下是多余的。
在其网站上,OMG列出了几个已经成功使用自动MDA生成高效的、成功的代码的一些大项目,它们比更传统项目用到更少的资源,这些项目包括威斯康星州劳动部、Postgirot银行、窥视镜网络公司、瑞士信用集团等。(全文结束)
文章来源于领测软件测试网 https://www.ltesting.net/