RE: [Commons, Collections, JXPath] Looking for more to read, pros/cons of filtering methods

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

RE: [Commons, Collections, JXPath] Looking for more to read, pros/cons of filtering methods

sabernar
For the record, my initial post on this topic had a subject line of:

        [Collections, JXPath] advantages/disadvantages

My question was:

        [W]hat are the advantages/disadvantages of using Predicate/Closure's to filter Collections of beans as opposed to using JXPath?

I'm not sure how much more specific I can be.  I don't have a specific filtering need that I need solved.  If I have a list of beans, and I want to filter them for, let's say it's a list of PersonBeans, hair color, where hairColor is an attribute of the PersonBean.  What are the advantages/disadvantages of using JXPath as opposed to functors?

Is that more specific?  Does that help?

-Shawn

-----Original Message-----
From: [hidden email]
[mailto:[hidden email]]
Sent: Wednesday, July 20, 2005 10:48 AM
To: Jakarta Commons Users List
Subject: RE: [Commons] Looking for more to reed


the simplest answer is that their nature are very different (JXPath does
XPath over java bean; the functors in collections are an expression of a
mathematical concept) though they can both be used to perform similar
functions (filtering a list).

but you probably knew that already.

for a better answer, i recommend that you clarify your question and to
prefix [jxpath] and [collections] to your subject.

- robert

> I was the one who asked about the difference between JXPath and Functors
> for filtering, but I never got an answer.
>
> -Shawn
>
>
> -----Original Message-----
> From: German Sibay [mailto:[hidden email]]
> Sent: Wednesday, July 20, 2005 10:13 AM
> To: Jakarta Commons Users List
> Subject: [Commons] Looking for more to reed
>
>
> Hello! I´m using commons in my organization and I´m preparing a course
> about Collections mostly but an introduction to Functors and others.
> The API is quite good, but I´m looking for reviews like this
> http://www.onjava.com/pub/a/onjava/2004/12/22/jakarta-gems-1.html?page=last
>
> I´m reading Jakarta Commons Cookbook (nice book!) too.
> So if any of you have any suggestion I´ll be glad to hear (read).
> Thanks a lot.
>
> One more thing: There was one question to this list a few weeks ago. It
> was about the difference between using JXPath and Collections or Functors
> for filtering and so. Performance and so?.
>
> Thanks again!
>
> Germán Sibay.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

RE: [Commons, Collections, JXPath] Looking for more to read, pros/cons of filtering methods

robert burrell donkin
> For the record, my initial post on this topic had a subject line of:
>
> [Collections, JXPath] advantages/disadvantages
>
> My question was:
>
> [W]hat are the advantages/disadvantages of using Predicate/Closure's to
> filter Collections of beans as opposed to using JXPath?
>
> I'm not sure how much more specific I can be.  I don't have a specific
> filtering need that I need solved.  If I have a list of beans, and I want
> to filter them for, let's say it's a list of PersonBeans, hair color,
> where hairColor is an attribute of the PersonBean.  What are the
> advantages/disadvantages of using JXPath as opposed to functors?
>
> Is that more specific?  Does that help?

jxpath is more expressive and requires no coding but requires more
learning. the bean functors in beanutils are somewhere between the two
extremes.

is that good enough?

- robert


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [Commons, Collections, JXPath] Looking for more to read, pros/cons of filtering methods

Stephen Colebourne
In reply to this post by sabernar
Bernard, Shawn wrote:
> For the record, my initial post on this topic had a subject line of:
>
> [Collections, JXPath] advantages/disadvantages
>
> My question was:
>
> [W]hat are the advantages/disadvantages of using
 > Predicate/Closure's to filter Collections of beans as
 > opposed to using JXPath?

JXPath (or EL/JEXL) is simply a way of getting a piece of data from a
complex structure (XML or Bean).

Functors can be used for this purpose too (and might perform slightly
faster as the code is real, not interpretted from a parsed string).

However, functors are really intended for deeper problems, specifically
actually performing processing. See
http://www.onjava.com/pub/a/onjava/2004/12/22/jakarta-gems-1.html?page=last 
for a good example.

Stephen

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [Commons, Collections, JXPath] Looking for more to read, pros/cons of filtering methods

tobrien
Stephen Colebourne wrote:

> Bernard, Shawn wrote:
>
>> For the record, my initial post on this topic had a subject line of:
>>
>>     [Collections, JXPath] advantages/disadvantages
>>
>> My question was:
>>
>>     [W]hat are the advantages/disadvantages of using
>
> > Predicate/Closure's to filter Collections of beans as
> > opposed to using JXPath?
>
> JXPath (or EL/JEXL) is simply a way of getting a piece of data from a
> complex structure (XML or Bean).
>
> Functors can be used for this purpose too (and might perform slightly
> faster as the code is real, not interpretted from a parsed string).
>
> However, functors are really intended for deeper problems,
> specifically actually performing processing. See
> http://www.onjava.com/pub/a/onjava/2004/12/22/jakarta-gems-1.html?page=last 
> for a good example.
>
...and even that example is very contrived.  Plus, the guy who wrote
that article is a jerk.  :-)  It is difficult to come up with Functor
examples that make sense.

An anonymous functor (specifically a Predicate) seems to me to be just
as straightforward as introducing JXPath.  I think functors are more
straightforward conceptually, but it is more of a style choice at this
point.  I'm interested in writing a performance test of both approaches.

Tim



---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

RE: [Commons, Collections, JXPath] Looking for more to read, pros/cons of filtering methods

sabernar
In reply to this post by sabernar
Tim, I'd love to see a performance comparison between the two approaches.  Using the two approaches with examples of differing complexities would be interesting to see.  

-Shawn

-----Original Message-----
From: Tim O'Brien [mailto:[hidden email]]
Sent: Thursday, July 21, 2005 4:17 PM
To: Jakarta Commons Users List
Subject: Re: [Commons, Collections, JXPath] Looking for more to read,
pros/cons of filtering methods


Stephen Colebourne wrote:

> Bernard, Shawn wrote:
>
>> For the record, my initial post on this topic had a subject line of:
>>
>>     [Collections, JXPath] advantages/disadvantages
>>
>> My question was:
>>
>>     [W]hat are the advantages/disadvantages of using
>
> > Predicate/Closure's to filter Collections of beans as
> > opposed to using JXPath?
>
> JXPath (or EL/JEXL) is simply a way of getting a piece of data from a
> complex structure (XML or Bean).
>
> Functors can be used for this purpose too (and might perform slightly
> faster as the code is real, not interpretted from a parsed string).
>
> However, functors are really intended for deeper problems,
> specifically actually performing processing. See
> http://www.onjava.com/pub/a/onjava/2004/12/22/jakarta-gems-1.html?page=last 
> for a good example.
>
...and even that example is very contrived.  Plus, the guy who wrote
that article is a jerk.  :-)  It is difficult to come up with Functor
examples that make sense.

An anonymous functor (specifically a Predicate) seems to me to be just
as straightforward as introducing JXPath.  I think functors are more
straightforward conceptually, but it is more of a style choice at this
point.  I'm interested in writing a performance test of both approaches.

Tim



---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]