Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [handly-dev] Doing work in Handle or in Body

Hi Vladimir,

I am still a bit uncertain about how to separate handles and bodies, so I'm reviving this older discussion.

The thing that bothers me is that for models that are more complicated than a toy, projects get their configuration from a file or preferences. This configuration belongs to the body, as it's not lightweight and is not a value object since it can be changed. The problem is that, using your simple Java model as example, in order to decide if we should create a handle for a folder or not (if it's on the classpath or not), we need to access the project body to read the classpath. This in turn might trigger building the project's structure and operating with handles is no longer lightweight. 

In your Java example you hide this in the API by catching the CoreException, but the side effects can still be significant. In practice it means that there are very few operations that will be "handle only", so I'd like to hear your thoughts about it.

best regards,
Vlad


On Tue, Dec 23, 2014 at 9:34 AM, Vladimir Piskarev <pisv@xxxxx> wrote:
Hi Vlad,
 
I think the distinction between handle and body is mostly about data,
not computation. As far as I can tell, JDT usually puts computation
in handles, and treats bodies as data holders. However, there is no
hard rules here, and I would suggest following common OOP sense
when deciding this question. Anyway, clients initiate computation
through handles, regardless of where it is actually implemented
(as a rule).
 
If you could come up with some code snippets or pointers to
source code in your git repository, I might be able to provide
more guidance (if needed).
 
Best regards,
Vladimir
 
 
Hi!

On Fri, Dec 19, 2014 at 3:59 PM, Vladimir Piskarev <pisv@xxxxx> wrote:
There is no rule that non-handle-only methods must delegate their work to a body (if I understand you correctly). I think what's really important here is the distinction between "handle only" and "other" methods for model elements; contract rather than implementation details.

Well, not a rule, but the whole point of the framework is to separate the lightweight functionality from the heavier one. There is a cache for bodies, so implementing heavy things in the handle might lose some efficiency.

Using "throws CoreException" as a discriminator is a good idea. Thanks!

regards,
Vlad



_______________________________________________
handly-dev mailing list
handly-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/handly-dev


Back to the top