On 11/20/07, Viktor Klang <[EMAIL PROTECTED]> wrote:
> for(Node node : root.traverse(byBreadth.include(MyRelTypes.DADDY,
> Orientation.INCOMING
> ).returnAll(myReturnEval).randomizeWith(myRandEval).until(END_OF_NETWORK))
>  foo(node);

I think this looks great. Even though it doesn't show in the core API,
I'm a big fan of fluent interfaces. I also like that you externalized
the configuration of a traverser into a separate class -- it *does*
make for better separation of concerns.

I opted (after long and hard -- and probably mistaken! -- thinking) to
NOT do that in the current API, because I didn't want to introduce Yet
Another Class with no purpose other than passing it into
node.traverse... and I'm still not entirely convinced about how often
you'd save and reuse configurations. But in either case it seems to
make for clearer code, particularly with a fluent API.

I'm very hestitant about adding things to the core API though. That
API should be as stable as possible and the current package has been
battle tested across a number of projects for 5+ years. We have some
components that may migrate into the core API in the future (meta
model comes to mind, maybe indexing as well) but I'd like to keep them
outside of it so they can evolve and mature independently.

>From what I see, with a single static import you're set to go as a
very thin separate component. For example:

   Traverser friends = from( startNode ).traverseBy( BREADTH ).using(
KNOWS, OUTGOING ).return( ALL_BUT_START_NODE ).until( END_OF_NETWORK
);
   for ( Node friend : friends )
   ...

or, for nicer inlining in the foreach loop:

   for ( Node node : traversalFrom( StartNode ).byBreadth().using( yadayada...
   ...

If you want to, I can create a dir for it in our svn tree. Then it'd
just be a matter of including it in a client's pom alongside the
actual neo dependency. We're a bit behind in our infrastructure tho so
it may take a day or two until I can have that sent to you.

WDYT?

Cheers,

-- 
Emil Eifrém, CEO [EMAIL PROTECTED]
Neo Technology, www.neotechnology.com
Cell: +46 733 462 271 | US: 206 403 8808
_______________________________________________
Neo mailing list
User@lists.neo4j.org
http://lists.neo4j.org/mailman/listinfo/user

Reply via email to