EMF4Net is a proposed open source component under the Eclipse Modeling Framework Technology (EMFT) project. The component's purpose is to provide the core functionality of the Eclipse Modeling Framework (EMF) for the .Net platform. EMF4Net should allow the generation of C# code from Ecore models and the usage of that code in a similar way the Java code generated by EMF can be used.
This proposal is in the Project Proposal Phase (as defined in the Eclipse Development Process document) and is written to declare the intent and scope of the component. This proposal is written to solicit additional participation and input from the Eclipse community. Everyone is invited to comment on and/or join the component. Please send all feedback to the eclipse.technology.emft newsgroup (please prefix the subject with [EMF4Net]).
EMF provides a generic code generation facility for Ecore models and code generation templates for Java. The generated Java code is embedded into a Java framework that supports standard functionalities like serialization, notification, adapters, reflection, and others. The availability of these functionalities out of the box boost productivity of EMF modeling and code generation in comparison to "plain old Java programming".
Neither Ecore nor the EMF code generation facility are limited to Java but provide the ability to generate code for other object-oriented languages like Smalltalk, C++, C#, or Ruby. However, the generation of non Java code alone does not make that code as useful as the Java code generated by EMF, because EMF's core runtime is missing in the non Java languages. This means that a sound enhancement of EMF to other programming languages also need to provide EMF's core runtime for that languages.
C# and .Net
C# is an object-oriented programming language developed by Microsoft to compete with Java. It is designed for server, desktop as well as embedded system environments. C# is the leading language of the .Net initiative and approved as ECMA and ISO standard. The syntax is based on C++ and borrows many aspects from Java and Delphi. C# and .Net are used by a huge development community all over the world.
Due to the intermediate language approach (which is similar to Java's bytecode) and the language independent nature of the .Net platform a program or library written in C# can be used in any program written in another .Net language like Visual Basic or Managed C++. As automatic translations between any .Net languages are possible, a translation of EMF's core runtime to C# is also usable for programmers of other .Net languages.
Unification of UML, XML, Java, and C#
EMF unifies UML, XML and Java at the modeling abstraction level by providing means to interchange any of this "data model" representations. EMF4Net tries to add C# as a fourth interchangeable modeling language to EMF.
The objectives for an initial version of EMF4Net are:
- Adaptation of the EMF code generation templates that produce Java model code to produce C# model code
- Translation of EMF's core runtime from Java to C#. This includes the translation of the EMF libraries org.eclipse.emf.ecore, org.eclipse.emf.common, org.eclipse.emf.ecore.xmi and org.eclipse.emf.ecore.change.
- Creation of an Eclipse plugin that makes the usage and customization of the EMF4Net C# code generation facility as straight forward and easy as possible. The C# code generation customization data is stored in a XMI file (e.g. .csGenModel similar to the EMF .genmodel file) to allow automatic (headless) invocation of the code generation
- A wizard that assists the user creating a .csGenModel
- Support integration of the generated C# code and the translated EMF core runtime into existing .Net IDEs
Additional functionality considered for later versions of EMF4Net:
- Provide the possibility to generate C# code with specific language constructs like properties (instead of Java Bean style setter and getter methods), delegates, XML comments and others
- A code merge functionality for the generated C# code analog to EMF's usage of JMerge
- Import of Ecore models from annotated C# code
Note that the scope can be further augmented as warranted by community interest.
The translation approach of EMF's core runtime from Java to C# is analog to the approach of the NUnit project by translating xUnit to C#: For an initial version transliterate the EMF code to C#. Later on improve the translation by using C# specific language constructs.
Ecore, EMF's features and the EMF implementation are the de facto modeling framework standard and EMF4Net intends to implement this de facto standard in C#.
We see the following primary advantages:
- Promote Eclipse and EMF as the one modeling framework of choice for common development platforms (like xUnit is the one test framework of choice for Smalltalk, Java, C#, C++ and other programming languages)
- Allow current EMF users to seamlessly transfer their modeling and modeling-tools know-how to the .Net platform
- Allow .Net programmers access to EMF modeling techniques
- Enable seamless model and model data exchange between Java and .Net by supporting the EMF standard XMI serialisation
- Promote Eclipse, EMF, and Ecore to the .Net community
- Ed Merks, IBM
- Group Technologies AG, Karlsruhe, Germany
- Remy Chi Jian Suen, Emonic (Eclipse-Mono-Integration) project
- Lucas Bigeardel, EMF Search
Interested parties are welcome to add themselves to the list above or to suggest changes to this document.
Tentative development roadmap
A test-driven development approach is intended for the translation of the EMF core runtime. Existing and new JUnit tests for EMF functionalities are translated into NUnit tests. Then EMF code is translated from Java to C# until the NUnit test succeeds.
Currently we intend the following translation order of EMF functionalities:
- Adaption of EMF's Java code generation templates for C#
- Translation of the org.eclipse.emf.ecore and org.eclipse.emf.common libraries
- XMI Serialization - translation of the org.eclipse.emf.ecore.xmi library
- Notification and Adapters
- Dynamic modeling API
- Translation of the org.eclipse.emf.ecore.change library
To make the usage of EMF4Net as easy and straight forward as possible, we intend to develop the following additional software components:
- C# code generation Eclipse plugin
- Integration into existing .Net IDEs
- C# code generation Wizard
Note that the order of implementation can be adapted to community interest.