jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexander Klimetschek <aklim...@day.com>
Subject Re: David's Model question : nt:unstructured and SNS
Date Mon, 16 Nov 2009 18:12:10 GMT
2009/11/16 Fran├žois Cassistat <f@maya-systems.com>:
> I think JCR+OCM is perfect for rapid development.

Please explain: why should adding a code layer be more rapid?

I agree that the JCR layer might not cover all typical operations in
convenient methods, but you can provide helper methods for that (eg.
jackrabbit-jcr-commons) that make life easier but still only depend on
the JCR API.

> The only complexity it
> adds is on performances, I found the code to be more readable with OCM.
>
> Maybe I do not have much experience with "low-level" JCR programming, but
> the problem with manipulating nodes is that you get all kind of variables
> which you never know how to name (parentNode, node, subNode[], nodeToDelete,
> newNode, etc.) and it becomes unreadable and when your code gets bigger.

I guess in most cases utility methods, as mentioned above, will solve
this. In addition, suggesting you have a simple node = object mapping,
I don't see why you shouldn't get the same "complexity" of variable
names with your DAO entities. And nobody forces you to use "node" in
the variable name. Using scripting, property access becomes even
simpler (see Apache Sling, Javascript or the ValueMap from the sling
api). Only in Java the "getProperty()" way of reading properties might
be a bit cumbersome, but IMO nothing that is so bad that it should add
a new layer, dependencies and more code:

    Node user = session.getRootNode().getNode("home/users/johndoe");
    user.getProperty("name").getString();
    ....

> I found myObject.save() to be straightforward and clean.

A problem with object.save() is often that you don't really know the
scope of the session/transaction. Explicit handling is better, eg. in
the context of webapps it's typically one session per request. JCR 2.0
goes fully onto this and deprecates Item.save() (albeit still
supported by Jackrabbit) and only allows a Session.save().

Regards,
Alex

-- 
Alexander Klimetschek
alexander.klimetschek@day.com

Mime
View raw message