EMF Dos and Don´ts #1

February 26, 2013 | 3 min Read

EMF is a very powerful framework and with power comes…responsibility. You can achieve great things with a minimum of effort using EMF. But, if something goes wrong you can also spend hours trying to find out why. This blog post is the pilot of a series on things you should do and things you should not do when using EMF. The series will present the content of my talk at Eclipse Con North America 2013 as blog posts.

Consider the following: you have defined a model in Ecore, you’ve generated code from the model and you’ve written a small RCP application to edit the data based on EMF Databinding or the EMF Client Platform. However, you find that the application tends to get very slow over time and certain values get lost in the model if it is stored and reloaded. Any of these problems might be caused by a small mistake such as forgetting about the disposal of a ComposedAdapterFactory, adding or removing content adapters to/from the model or changing EMF Factory code to implement a default initialization for an EObject. It can take hours or days until you find the cause of your problem. With this blog, series I hope to save you at least a few hours of searching for a problem…given you follow my advice ;). Currently my list includes 25 items. Let´s start with the first.

EMF Dos #1: RTFM - a.k.a. please read the manual

Manual? There is no manual. Well, there is kind of a manual. In fact, there are a couple of different manuals. This is what I found most useful when starting with EMF:

  • Follow a tutorial on EMF.  If you happen to attend an EclipseCon, join an EMF Tutorial. Otherwise, try an online tutorial. In my opinion, it is always better to try things out before reading a book about them.
  • Having said this, read the EMF book. For me, the book was very helpful for looking up things I came across, e.g. “What are feature maps?”.
  • Read the EMF source code to understand how something works. It helped me to better understand how the overall framework works.
  • Finally and most importantly, search the EMF newsgroup. There is almost no problem that has not been encountered by someone else before you, and answered by Ed Merks. After all, the framework is named after him…E.M.F.
  • Alternatively or additionally, hire a consultant :P

Stay tuned for more Dos and Don´ts in my next blog!

You can also directly jump to the available posts on EMF Dos and Don´ts:

Jonas, Maximilian & Philip

Jonas Helming, Maximilian Koegel and Philip Langer co-lead EclipseSource. They work as consultants and software engineers for building web-based and desktop-based tools. …