Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » EMF Design: Why subclass instead of decorator?
EMF Design: Why subclass instead of decorator? [message #421161] Tue, 29 July 2008 14:25 Go to next message
Christian Hall is currently offline Christian HallFriend
Messages: 15
Registered: July 2009
Junior Member
I know this is going to be hard to answer in summary form, but I am
wondering (long story...design thinking related to EMF concepts) about
what went into the decision to have generated EMF classes extend their
loosely typed parents (EObjects) as opposed to decorating them.

In other words, instead of having MyThing extend EObject, an instance of
MyThing could have decorated an instance of EObject.

Maybe this was just to keep the generated code clear of a bunch of
delegating methods. But I would assume there was more to this. Can someone
just brain dump out a couple of reasons so I can settle my mind about this?
Re: EMF Design: Why subclass instead of decorator? [message #421168 is a reply to message #421161] Tue, 29 July 2008 16:03 Go to previous messageGo to next message
David Steinberg is currently offline David SteinbergFriend
Messages: 489
Registered: July 2009
Senior Member
Hi Christian,

The intent of EObject is to provide a base set of behaviors provided by
all modeled objects that allow them to participate in the framework.
It's analogous to (though obviously richer than) java.lang.Object.

Most of these concepts are all wrapped up in the identity of the object
(container, notification, etc.), so it just seems logical to me, anyway,
to have the object itself provide them. If we took the decorator
approach, would eObject().getContainer() return the container object
itself (as eContainer() does) or would it return the EObject being
decorated? Would notifications sent by the wrapped EObject say that the
decorator or the EObject was the notifier?

These are just my thoughts, and I wasn't a part of this design decision,
but I can't really imagine it working well any other way.

Cheers,
Dave

Christian wrote:
> I know this is going to be hard to answer in summary form, but I am
> wondering (long story...design thinking related to EMF concepts) about
> what went into the decision to have generated EMF classes extend their
> loosely typed parents (EObjects) as opposed to decorating them.
> In other words, instead of having MyThing extend EObject, an instance of
> MyThing could have decorated an instance of EObject.
> Maybe this was just to keep the generated code clear of a bunch of
> delegating methods. But I would assume there was more to this. Can
> someone just brain dump out a couple of reasons so I can settle my mind
> about this?
>
Re: EMF Design: Why subclass instead of decorator? [message #421199 is a reply to message #421168] Wed, 30 July 2008 12:38 Go to previous message
Christian Hall is currently offline Christian HallFriend
Messages: 15
Registered: July 2009
Junior Member
Thanks for this. I had a brain freeze yesterday on this question in
another design and was looking for parallels. This is the kind of thing
that is hard to find discussed in general anywhere and I knew there would
be someone here that would be able to point out something.
Previous Topic:Re: Teneo and Hibernate's Session.load() issue
Next Topic:HowTo specify that an EReference must be "mapped" on another?
Goto Forum:
  


Current Time: Wed Sep 25 16:59:07 GMT 2024

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

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

Back to the top