What is Eclipse Modeling Framework?
I am sorry, this might look too simple, but I am vague about what Eclipse Modeling Framework is?
B开发者_运维知识库ased on their website, it generates java code, based on XML specification.
I wonder if it is something like Visual Paradigm? And does it generate code for other languages (such as PHP) or just for Java?Thanks.
EMF is a framework that can take a model (as described in a .ecore
file) and generate the supporting Java files that can be used with EMF to build, load, manipulate and save instances of that model.
That means you use EMF when you are writing a Java application and want to manipulate a model (an abstract syntax tree for a language, a model that can be displayed by your View, a domain that needs to be manipulated, etc).
There are a lot of modeling projects, and they add support for more and more functionality but most of it is based on EMF.
Basically, EMF is a framework for developing model driven development (MDD) tools.
The tools you will be interested in are in the Model To Text (M2T) section. Using tools like JET you can generate logic-containing business objects, not just simple DTOs, in any language you want. You can generate code from domain-specific languages (DSL) that you define yourself (usually in XML) or from standard modeling languages (UML or Encore).
When you have picked a modeling language, there are ways to build your models using graphical tools (GMF). In addition, EMF has the validation/translation tools you would expect.
Having tried out several of the code generation tools, I can say that it was a worthwhile experiment. However, it requires a significant investment to learn and puts you at risk of depending on one particular tool. If you find yourself in want of a code generation tool, also consider that you may have a language smell or haven't refactored out enough duplication.
精彩评论