Last updated : 01/10/2002; 18:20:47

Joe's Jelly

Joe Walnes rambling on and on about Software Development, Java and Extreme Programming.

NAVIGATION >>

/WIKI /WEBLOG /THOUGHTWORKS /OPENSYMPHONY /EMAIL

:: ELSEWHERE
xp developer wiki
c2 xp wiki
the server side
javaworld
sd magazine
jakarta

:: BLOGS
Mike Cannon-Brookes
Graham Glass
Paul Hammant
Elliotte Rusty Harold
Darren Hobbs
Patrick Lightbody
Charles Miller
Brett Morgan
Rickard Öberg
Mike Roberts
Sam Ruby
Joel Spolsky
James Strachan
Clemens Vasters

:: INVOLVEMENTS
SiteMesh
QDox
MockDoclet
OSCore
OSUser
PropertySet
RichTags
Marathon
SiteMesh C++
Alt-RMI
Jelly MockTags
more...
:: BACKLOGS
September 2002
Sun Mon Tue Wed Thu Fri Sat
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30          
Aug   Oct



Click here to visit the Radio UserLand website.

:. 23 September 2002

  1:08:43 PM  

... and my comeback to Mike's comeback to Joe ...

Agreed - a persistence layer is essential for any large project. Once you know how to use your framework properly, you'll use it for small projects too. I can get the EE up and running for new projects in literally minutes - including building the whole entity model. Do that with JDO

The only thing extra I have to add to my projects is add a <jdo srcdir="src" destdir="classes"/> ant task and @jdo JavaDoc comments to the classes I need persisted (custom built with QDox - plug plug!) - and that's it. That task will scan my source dir for classes marked as persistent - generated the mapping files (which I never look at) into a tmp directory, tell Kodo to enhance the class bytecode and connect to my db and update the schema. Lots of stuff going on under the hood, but all I have to do is add one ant taskdef and include a Jar.

I find that the performance of OR frameworks is generally pretty poor. The problem with 'use objects and let the framework handle persistence' is that you really do need to know how the framework works to work out the performance of your code. Same deal with RMI. You can't really just forget the object is remote, or your code will be hellishly slow.

I agree with that. You still need to be aware of it's persitence but (mostly) it shouldn't cause extra code to be written. It's like knowing when to use and ArrayList and when to use a LinkedList.

Joe then defines JDO....

I wish JDO defined this much :). Kodo offers much more than the raw JDO spec - most other JDO implementations are a bit sucky :(

Classes define all. Definitions of data schemas should come from the java classes themselves, not config files or existing databases.

I don't agree. I love the ability to edit the entitymodel.xml file and add new entities in a flash. It's wickedly fast, and OFBiz goes and creates the tables and columns for me. Granted by your definition OFBiz isn't an OR framework as it doesn't map objects directly.

OfBiz does make this pretty easy.

The reason I like classes is because you have the power of strongly typed objects. If you want to change your model it makes it pretty easy to do with IDE based refactoring tools. It's hard to do this with strongly typed objects. It also allows objects to have behavior associated with them and data to be neatly encapsulated.

Granted it is easier to write the classes in pure XML but defining a simple class isn't that much work and the advantages above are well worth it.

Transparent database management. The tool should be able to look at your object model and find out what changes need to be done to the database schema to support it (and optionally make the changes).

This is a must, and something that very few frameworks do at all.

Aye. Thankfully Commons-SQL is trying to remedy this by providing a reusable set of database management tools (such as schema generation/migration) which can be used in conjunction with other O/R tools.

Hibernate, Object Relational Bridge, Castor, and OfBiz are all awesome opensource products. I'm not knocking them! :)


  12:41:18 PM  

Transparent RMI. There's an interesting article over on JavaWorld: "Empower RMI with TRMI". Transparent RMI makes it simpler to create RMI services. No more extending Remote and having every method throw RemoteException & it also centralizes error handling on the client side. It appears to be using dynamic proxies to simplify things... I need to investigate this further. [Otiose Cognitions]

While you're at it, have a look at altRMI. [Pushing the envelope]

Yes, definately have a look at the mighty Paul Hammant's AltRMI (and EOB while you're at it)! It's very fast and very configurable (pluggable proxy/marshalling schemes, transports, etc).


  11:57:54 AM  

Broken Record.

Mike Writes:

The biggest problem I have with almost all frameworks is the findAll() curse that actually ends up loading too many objects. You have the EJB approach (findAll() just returns primary keys, and then the objects are lazy loaded), or the OFBiz approach (findAll() loads the whole record set in a single query) - but ne'er the twain do meet. - rebelutionary

I hate to sound like a broken record, but hibernate allows both approaches. sess.find() will return you a List of pre-loaded objects, while sess.iterate() returns you an Iterator that will lazily load each object when you call next().

[The Desktop Fishbowl]

Hehe. Plug away! I have no affiliation with Kodo, but I'm plugging it for fulfilling everything on my list. It uses a combination of the lazy load and caching approach which works very well. If I do a getAll() to return one million items but only iterate through the first twenty it performs as well as you'd expect.


Web-design by John Doe from open source web design.