You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cayenne.apache.org by Michael Gentry <mg...@masslight.net> on 2009/10/08 18:09:07 UTC

ObjectContext Questions

In changing ObjectContext, I added:

    void deleteObjects(Collection<Persistent> objects) throws
DeleteDenyException;

Does it make sense to use <Persistent> here?  After all,
deleteObject() doesn't use it:

    void deleteObject(Object object) throws DeleteDenyException;

Neither do the things that return collections:

    ...
    Collection<?> deletedObjects();
    Collection<?> modifiedObjects();
    ...



Also, I noticed this added to 3.0:

    void prepareForAccess(Persistent object, String property, boolean
lazyFaulting);

Seems like that boolean would be another good place to have an enum instead?

Thanks,

mrg

Re: ObjectContext Questions

Posted by Andrus Adamchik <an...@objectstyle.org>.
Yeah, I wasn't making an excuse, just sharing my perception of  
reality :-)

Andrus

On Oct 9, 2009, at 4:23 PM, Michael Gentry wrote:

> I'm quite OK with incremental changes.  I was just pointing out that
> when you look at that one class (which is pretty core) it is a bit of
> a head-scratcher.  No worries, though.  And no one expects you to be
> Howard.  One of Cayenne's strengths is the stability it has had.
>
> Thanks,
>
> mrg
>
>
> On Fri, Oct 9, 2009 at 7:42 AM, Andrus Adamchik <andrus@objectstyle.org 
> > wrote:
>>
>> On Oct 8, 2009, at 10:40 PM, Michael Gentry wrote:
>>
>>> It just seems like it is caught in 3 different lands: pre-generics,
>>> generics, and POJO.
>>
>> That's one of my biggest headaches. You'd be experimenting with new  
>> things,
>> going through trial and error cycles, learning, gathering feedback,  
>> and then
>> somewhere along that way your unfinished designs become public API  
>> and you
>> can't change it anymore. This is why JPA was so attractive at first  
>> - it has
>> a very thin layer of public API, and 85% of the framework is  
>> private. And
>> this is why I brought up dependency injection (and implicitly,  
>> coding to
>> interfaces) as a prospective future direction.
>>
>> Hmmm... sometimes I feel like attacking that the Tapestry (or Log4J/ 
>> SLF4J)
>> way - rewriting things from scratch to have a fresh and fully  
>> consistent
>> framework. But then I realize that I won't be able to spend the  
>> next 2-3
>> years of my life to create something that is already available and  
>> works,
>> and lose the entire community in the process.
>>
>> Alas, we are stuck in the imperfect world, and will have to make  
>> incremental
>> changes :-/
>>
>> Andrus
>


Re: ObjectContext Questions

Posted by Michael Gentry <mg...@masslight.net>.
I'm quite OK with incremental changes.  I was just pointing out that
when you look at that one class (which is pretty core) it is a bit of
a head-scratcher.  No worries, though.  And no one expects you to be
Howard.  One of Cayenne's strengths is the stability it has had.

Thanks,

mrg


On Fri, Oct 9, 2009 at 7:42 AM, Andrus Adamchik <an...@objectstyle.org> wrote:
>
> On Oct 8, 2009, at 10:40 PM, Michael Gentry wrote:
>
>> It just seems like it is caught in 3 different lands: pre-generics,
>> generics, and POJO.
>
> That's one of my biggest headaches. You'd be experimenting with new things,
> going through trial and error cycles, learning, gathering feedback, and then
> somewhere along that way your unfinished designs become public API and you
> can't change it anymore. This is why JPA was so attractive at first - it has
> a very thin layer of public API, and 85% of the framework is private. And
> this is why I brought up dependency injection (and implicitly, coding to
> interfaces) as a prospective future direction.
>
> Hmmm... sometimes I feel like attacking that the Tapestry (or Log4J/SLF4J)
> way - rewriting things from scratch to have a fresh and fully consistent
> framework. But then I realize that I won't be able to spend the next 2-3
> years of my life to create something that is already available and works,
> and lose the entire community in the process.
>
> Alas, we are stuck in the imperfect world, and will have to make incremental
> changes :-/
>
> Andrus

Re: ObjectContext Questions

Posted by Andrus Adamchik <an...@objectstyle.org>.
On Oct 8, 2009, at 10:40 PM, Michael Gentry wrote:

> It just seems like it is caught in 3 different lands: pre-generics,
> generics, and POJO.

That's one of my biggest headaches. You'd be experimenting with new  
things, going through trial and error cycles, learning, gathering  
feedback, and then somewhere along that way your unfinished designs  
become public API and you can't change it anymore. This is why JPA was  
so attractive at first - it has a very thin layer of public API, and  
85% of the framework is private. And this is why I brought up  
dependency injection (and implicitly, coding to interfaces) as a  
prospective future direction.

Hmmm... sometimes I feel like attacking that the Tapestry (or Log4J/ 
SLF4J) way - rewriting things from scratch to have a fresh and fully  
consistent framework. But then I realize that I won't be able to spend  
the next 2-3 years of my life to create something that is already  
available and works, and lose the entire community in the process.

Alas, we are stuck in the imperfect world, and will have to make  
incremental changes :-/

Andrus


Re: ObjectContext Questions

Posted by Michael Gentry <mg...@masslight.net>.
I thought it might have something to do with the JPA/POJO stuff, but
wasn't sure.  Of course, other parts of the API in that class take a
Persistent parameter, such as:

    Persistent localObject(ObjectId id, Object prototype);
or
    void prepareForAccess(Persistent object, String property, boolean
lazyFaulting);

It just seems like it is caught in 3 different lands: pre-generics,
generics, and POJO.

mrg


On Thu, Oct 8, 2009 at 2:56 PM, Andrus Adamchik <an...@objectstyle.org> wrote:
>
> On Oct 8, 2009, at 7:09 PM, Michael Gentry wrote:
>
>> Does it make sense to use <Persistent> here?  After all,
>> deleteObject() doesn't use it:
>>
>>   void deleteObject(Object object) throws DeleteDenyException;
>
> Good question... Using Object instead of Persistent was a move towards POJO
> persistent objects, which only happened half way in 3.0... I am ok if we do
> not parameterize the collection here.
>
>
>> Also, I noticed this added to 3.0:
>>
>>   void prepareForAccess(Persistent object, String property, boolean
>> lazyFaulting);
>>
>> Seems like that boolean would be another good place to have an enum
>> instead?
>
> Actually no. To me it looks like a case when boolean is just that - a
> boolean.
>
> Andrus
>
>

Re: ObjectContext Questions

Posted by Andrus Adamchik <an...@objectstyle.org>.
On Oct 8, 2009, at 7:09 PM, Michael Gentry wrote:

> Does it make sense to use <Persistent> here?  After all,
> deleteObject() doesn't use it:
>
>    void deleteObject(Object object) throws DeleteDenyException;

Good question... Using Object instead of Persistent was a move towards  
POJO persistent objects, which only happened half way in 3.0... I am  
ok if we do not parameterize the collection here.


> Also, I noticed this added to 3.0:
>
>    void prepareForAccess(Persistent object, String property, boolean
> lazyFaulting);
>
> Seems like that boolean would be another good place to have an enum  
> instead?

Actually no. To me it looks like a case when boolean is just that - a  
boolean.

Andrus