Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Some thoughts on EMF intrefaces
Some thoughts on EMF intrefaces [message #781050] Fri, 20 January 2012 08:19 Go to next message
Martin  odloucký is currently offline Martin odlouckýFriend
Messages: 49
Registered: July 2010
Member
Hi everyone,

I wouůd like to here your opinion on something I just realized when using EMF. When I redisigned and refactored and redesigned again my model in EMF towards greater abstraction I ended up with model built only of interfaces. Then I finally realized that I used interfaces only to ensure that I can extend more than one class in my subsequent models. Since EMF can work with multiple inheritance I actually do not need any interfaces for that purpose at all. So I changed all the classes to abstract since generating the implementation does not cost anything and does not hurt either.
Is this the correct insight? The EMF now looks to me like all the classes in any EMF model are more like interfaces - they only capture relationships among the modeled objects, nothing more.
Maybe this is also a reason for the model generator to always generate a set of java interfaces for ALL classes in the model, abstract or not.

I am growing fond of EMF, it looks very exciting and I'd like to educate myself as much as possible so that's way I am posting this experience of mine....

Re: Some thoughts on EMF intrefaces [message #781175 is a reply to message #781050] Fri, 20 January 2012 08:27 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33142
Registered: July 2009
Senior Member
Martin,

Comments below.

On 20/01/2012 9:19 AM, Martin odloucký wrote:
> Hi everyone,
> I wouůd like to here your opinion on something I just realized when
> using EMF. When I redisigned and refactored and redesigned again my
> model in EMF towards greater abstraction I ended up with model built
> only of interfaces. Then I finally realized that I used interfaces
> only to ensure that I can extend more than one class in my subsequent
> models. Since EMF can work with multiple inheritance I actually do not
> need any interfaces for that purpose at all. So I changed all the
> classes to abstract since generating the implementation does not cost
> anything and does not hurt either. Is this the correct insight?
You still get a generated Impl class when you make it abstract. You can
set "interface" to true (which also requires abstract to be true) and
then there won't get even the Impl classes.
> The EMF now looks to me like all the classes in any EMF model are more
> like interfaces - they only capture relationships among the modeled
> objects, nothing more.
Yes, but when mapped to Java, they map to both and interface and an
implementation class (by default).
> Maybe this is also a reason for the model generator to always generate
> a set of java interfaces for ALL classes in the model, abstract or not.
Yes, to support multiple inheritance in general, you generally always
need an interface. It's also nice to hide all the implementation
details behind interfaces...
>
> I am growing fond of EMF, it looks very exciting and I'd like to
> educate myself as much as possible so that's way I am posting this
> experience of mine....
>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:How to store gmf diagrams in CDO (Connected Data Objects) server ?
Next Topic:[TENEO] UML2 experience
Goto Forum:
  


Current Time: Fri Apr 26 08:14:17 GMT 2024

Powered by FUDForum. Page generated in 0.02998 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top