You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by Kevin Menard <km...@servprise.com> on 2007/09/14 19:09:53 UTC

Basic ROP questions

I'm just getting started on a ROP project using Cayenne 3.0.  In my server
classes, I had a large amount of utility methods attached to my DOs.
Clearly, there's a fair amount of overlap between the server classes and the
client classes.

A couple brief questions then follow:

1) Will modifying the Velocity template to subclass the servers classes help
reduce the code duplication?  Will this even work?

2) Will packaging either the server or the client classes into distributable
JARs gain me anything?

I'll try these out on my own anyway, but before I got too bogged down with
that, I just wanted to see what's doable and what's not.  I haven't looked
into the finer details of relationships between the server and client
classes.

Thanks,
Kevin


Re: Basic ROP questions

Posted by Aristedes Maniatis <ar...@maniatis.org>.
On 15/09/2007, at 3:09 AM, Kevin Menard wrote:

> I'm just getting started on a ROP project using Cayenne 3.0.  In my  
> server
> classes, I had a large amount of utility methods attached to my DOs.
> Clearly, there's a fair amount of overlap between the server  
> classes and the
> client classes.

I remember some time ago Andrus saying that he'd like to merge  
PersistentObject and CayenneDataObject one day. Doing so would  
certainly help a lot to share code between client and server. For  
instance in our project we have a lot of duplicate code for entity  
validation - since we want to run validation on the client without a  
round trip to the server. But of course we still need to have it on  
the server.


> 2) Will packaging either the server or the client classes into  
> distributable
> JARs gain me anything?

I don't think so. There is just no overlap in the class hierarchy. At  
the moment in the few places we managed to share some code between  
client and server we have done it through interfaces.


Ari


-------------------------->
Aristedes Maniatis
phone +61 2 9660 9700
PGP fingerprint 08 57 20 4B 80 69 59 E2  A9 BF 2D 48 C2 20 0C C8



Re: Basic ROP questions

Posted by Kevin Menard <km...@servprise.com>.
More notes.

The utility class idea doesn't really work because despite having the same
name and structure, they're not the same thing.  I guess I've been using
languages with duck typing a little too long.

This would dictate introducing an interface that the two hierarchies could
implement and the utility classes could work with.  I'll have to mess around
with Velocity to simplify things.

-- 
Kevin


On 9/14/07 4:16 PM, "Kevin Menard" <km...@servprise.com> wrote:

> Answering my first question . . . That's a definite no.  The parent class
> implementations are quite different.  So, I may just have to break down and
> create utility classes that accept DOs as arguments.  A bit of pain, but
> it'll reduce the code duplication.



Re: Basic ROP questions

Posted by Kevin Menard <km...@servprise.com>.
Answering my first question . . . That's a definite no.  The parent class
implementations are quite different.  So, I may just have to break down and
create utility classes that accept DOs as arguments.  A bit of pain, but
it'll reduce the code duplication.

-- 
Kevin


On 9/14/07 1:09 PM, "Kevin Menard" <km...@servprise.com> wrote:

> I'm just getting started on a ROP project using Cayenne 3.0.  In my server
> classes, I had a large amount of utility methods attached to my DOs.
> Clearly, there's a fair amount of overlap between the server classes and the
> client classes.
> 
> A couple brief questions then follow:
> 
> 1) Will modifying the Velocity template to subclass the servers classes help
> reduce the code duplication?  Will this even work?
> 
> 2) Will packaging either the server or the client classes into distributable
> JARs gain me anything?
> 
> I'll try these out on my own anyway, but before I got too bogged down with
> that, I just wanted to see what's doable and what's not.  I haven't looked
> into the finer details of relationships between the server and client
> classes.
> 
> Thanks,
> Kevin
> 

--