I am fine with it being a verb. The question is what verb. This action is not 
"attach". It is something else. I tried to describe it in other messages in 
this thread. 

Andrus
 

On Sep 4, 2011, at 9:20 PM, Aristedes Maniatis wrote:

> I also find localObject() a very confusing name. At the very least it should 
> be a verb, which is what Michael is getting at with his examples.
> 
>  context.attach(object)
> 
> This would be accompanied by changes in the documentation terminology. You 
> would "attach" an object to a context, either automatically in the case of 
> normal Cayenne object creation, or by hand for POJOs (the Hibernate way), 
> when copying from one context to another, etc. Ultimately the same verb 
> "attach" can be used to describe all those actions.
> 
> 
> 
> Ari
> 
> 
> On 4/09/11 10:03 AM, Michael Gentry wrote:
>> Just the other day I started to try to explain this to a co-worker and
>> essentially told them "don't question it, just use it."  That's
>> probably not the best answer.
>> 
>> I'm still not sure I like the method name localObject().  I think it
>> should be clear to the user that it takes an existing object (not a
>> new one) in one context and makes a copy of it to be also managed by a
>> different context.  We need to keep localObject() around for a bit,
>> though, for backward compatibility.
>> 
>> Throwing some naming ideas out:
>> 
>> add(object)
>> manage(object)
>> register(object)
>> registerExistingObject(object) -- would be similar to 
>> registerNewObject(object)
>> 
>> In short, though, I agree this API should die.  :-)
>> 
>> mrg
>> 
>> 
>> On Sat, Sep 3, 2011 at 5:16 PM, Andrus Adamchik<[email protected]>  
>> wrote:
>>> https://issues.apache.org/jira/browse/CAY-1611
>>> 
>>> I've got tired of doing:
>>> 
>>> Artist localArtist = (Artist) context.localArtist(artist.getObjectId(), 
>>> null);
>>> 
>>> Aside from causing confusion about the second argument (should it be 
>>> 'artist'? no, it should be null), it is still plain ugly. Anyone sees any 
>>> flaws with the reasoning behind this Jira?
>>> 
>>> Andrus
> 
> -- 
> -------------------------->
> Aristedes Maniatis
> GPG fingerprint CBFB 84B4 738D 4E87 5E5C  5EFA EF6A 7D2E 3E49 102A
> 

Reply via email to