I thought that my trustworthy Dell laptop with 2 GB of RAM will serve me throughout my Ph.D, but that was before I had to develop an Eclipse plug-in. A single instance of Eclipse Galileo modelling edition chews up 360 MB of RAM just for starters. Running another instance in debug mode doubles the weight, at least. Pile upon that a couple of UML2 documents with their fancy editors, et voila! Half of the RAM is gone.
Why is that? Even the notoriously hoggish IntelliJ IDEA 8 doesn’t take that much RAM. I don’t know for sure how comes Eclipse became the new memory hog in town, but I have a guess: It has something to do with EMF.
EMF stands for “Eclipse Modeling Framework”. It’s the underlying layer that enables all those nice property sheets and graphical editors. Basically, it adds highly-detailed reflection to Plain-Old Java Objects (POJOs) by generating a massive amount of code. This reflection is needed for auto-generating all that fancy GUI, but it requires supporting data structures - And that shows up on the system monitor.
(Btw, if you’re willing to pay the price for reflection, why not use a language that have native reflection, such as Python, and get rid of those code-generated monstrosities? Just a thought.)
No solution this time. It is a ranting post.
Guy Wiener on August 4th 2009 in Uncategorized
Meta-languages and meta-platforms are usually perceived as a complicated solution - Meta-code is a tricky thing. That’s no excuse, however, to make things even more complicated than they should be. The mental cost of thinking in meta-terms is enough: You don’t have to throw other complications in.
UML was never lightweight - A standard that was rolled out with 9 different diagrams sounds more like a committee’s compromise that something usable. When you start using UML meta-programming platforms (”Eclipse Galileo modeling” edition is shipped with a few) you find out just how ridiculously entangled it has become. The excellent Acceleo framework uses 3 different meta-languages (UML, OCL and EMF) to generate Java code that can generate other code from a UML model. Suddenly LISP’s Meta-Object Protocol or Python’s Metaclasses seems like the simple solution. Don’t get me wrong - Acceleo, comparing to other UML-based solution, is a great framework - But enough is enough. It’s difficult enough to write a meta-program in a single language. Two languages are somewhat expected too - A language and a meta-language. Piling 3 or 4 different frameworks into meta-programming is not the right solution - It’s the result of desparately trying to handle an over-complex meta-protocol.
I have some code generation program that I need to implement. Eventually, it will be an Eclipse-based plug-in… But before that, I think I’ll hack it in Python.
(Btw, there are alternatives to UML: OPM and Planguage to name a few. More to come on this)
Guy Wiener on July 12th 2009 in Uncategorized