EMF Introduction Series (EMF and MDA)

Source: Internet
Author: User

Friends who have been in touch with Eclipse for some time should have heard the name EMF, an acronym for the Eclipse Modeling Framework, an important subproject of eclipse, if translated into Chinese, is the Eclipse Modeling framework. It's really hard to determine what it's for, and I think that the EMF should have a certain understanding of model-driven development (MDA), and EMF can be seen as an implementation of MDA on Eclipse (code generation is one of the important components of MDA), It can generate code that executes on eclipse. Unfortunately, I have no systematic study of MDA, the application of EMF is mostly to reduce the impact of model changes, so I hope EMF can take me into the MDA world.

MDA is fastidious is the model and the application system realizes separates, the model is the most important part, may say has the clear model, has accomplished half of the work. The model is defined by the Metamodel (meta model), for example, the concepts of "classes" and "attributes" in UML are defined in the metamodel of UML, and the meta model is defined by the "meta model", which is mostly self-describing, that is, it can define itself, so it rarely sees the concept of "Wenyuan model". In the MOF specification, the Meta-meta model is in the M3 layer, the meta model is in the M2 layer, the M1 layer down is the model, and the M0 layer is the instance. EMF defines a set of Ecore metamodel, an implementation of emof (a subset of MOF, an acronym for Meta-object facility), a self-describing model that can be considered to be in the M2 layer of MOF, the same location as the UML Metamodel. The Ecore model can be defined with the Ecore element model, which is the. ecore file, which is at the M1 level, and the Ecore model instance is in the M0 layer. For more on MOF concepts refer to the MOF specification and related documentation, the various concepts of MDA are quite numerous, there are many people studying it, I think EMF is a more pragmatic one. If there is a chance to further study the Ecore meta model, I will also write the experience here for your reference.

EMF has been enthusiastically embraced by the eclipse community since its release, and many of the eclipse's subprojects are now based on it, and the EMF does benefit developers. With the development of EMF, there are more and more documents, and on the ECLIPSE.ORG/EMF can find many, most comprehensive and authoritative when belong to this eclipse modeling Framework A Developers Guide, complete explained EMF, Although the target version earlier, but most of the content is still applicable; As a primer, some of the tutorials listed in documents on the website are also good choices; EMF newsgroups are a good place to communicate, Ed. Merks (one of the EMF designers) and several other developers can be said to be asking questions, thanking them for their seriousness.

By using EMF in some projects, I also gradually feel the role of it, especially when the model of various elements and relationships, the EMF code generation function will save a lot of work, for our developers, this is not the biggest benefit. In fact, the process of using EMF to construct an application is simple: 1, constructs the model, 2, generates the code, the former can be defined by the UML class diagram, the Java interface, the XML schema and so on, the latter can choose to generate only the model part of the code, also can generate the editor part of Make a few customizations to the editor to get the application that meets your needs.

Class diagrams can help us to intuitively understand the relationship between the objects in the application system, but in the development process, the definition of the class diagram is likely to be modified, if this modification does not reflect back to the class diagram in time, the class diagram will gradually become inaccurate and lose its effect. But to keep code and class diagram consistent is a very cumbersome work, sometimes because of project management needs, the class diagram must ensure that the real structure of the system can be reflected. A better solution is to have the code be generated directly from the class diagram, and the model needs to be modified to make changes on the class diagram, and to regenerate the code, which is what EMF's expertise is.

Having said so much, you may still not be able to figure out what the EMF can do for us and how to save us a lot of work, starting with the next post, we'll step through the idea of how to construct an application using EMF. Because it is written on the side, so this series of posts will not be too long, I believe that the latter part will be based on ideas and skills, such as the main content.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.