Lambda the Ultimate

inactiveTopic Jakarta-Commons Collections Component
started 10/22/2002; 6:05:13 AM - last post 10/23/2002; 11:19:00 AM
Ehud Lamm - Jakarta-Commons Collections Component  blueArrow
10/22/2002; 6:05:13 AM (reads: 1938, responses: 6)
Jakarta-Commons Collections Component
...there are certain holes left unfilled by Sun's implementations, and the Jakarta-Commons Collections Component strives to fulfill them. Among the features of this package are:

  • Special-purpose implementations of Lists and Maps for fast access
  • Adapter classes from Java1-style containers (arrays, enumerations) to Java2-style collections.
  • Methods to test or create typical set-theory properties of collections such as union, intersection, and closure.

An interesting collection of Collections. Another example of using the java.util interfaces.


Posted to OOP by Ehud Lamm on 10/22/02; 6:15:02 AM

Ehud Lamm - Re: Jakarta-Commons Collections Component  blueArrow
10/22/2002; 6:16:58 AM (reads: 824, responses: 0)
For example: Closure.

Noel Welsh - Re: Jakarta-Commons Collections Component  blueArrow
10/22/2002; 8:18:16 AM (reads: 809, responses: 0)
It's a great example of how the OO method fails in certain domains! Too bad they didn't implement fold.

Isaac Gouy - Re: Jakarta-Commons Collections Component  blueArrow
10/22/2002; 8:29:20 AM (reads: 800, responses: 3)
Admirably terse!

Exactly what is "a great example of how the OO method fails in certain domains"?

Noel Welsh - Re: Jakarta-Commons Collections Component  blueArrow
10/23/2002; 1:09:55 AM (reads: 765, responses: 2)

Exactly what is "a great example of how the OO method fails in certain domains"?

Parts of the library are emulating functional style with OO mechanisms, such as the Closure interface that Ehud referenced. Due to various restrictions in Java (mostly its type system and the restrictions on inner classes) this is more painful to do than it ought to be. It would be easier to use and simpler to implement if Java supported functional style directly (like Smalltalk did :-). Hence I conclude that collection APIs are a domain to which OO is not suited. For comparison, the STL is written in largely functional style.

Ehud Lamm - Re: Jakarta-Commons Collections Component  blueArrow
10/23/2002; 1:23:18 AM (reads: 798, responses: 1)
I find the interfaces compelling. I agree that when it comes to iterators etc. I often miss the power of functional programming.

Funny enough, the generic programming based STL, is the way to introduce functional programming idiom into the mainly OOP style of C++. Now, that's a multiparadigm language...

Dan Shappir - Re: Jakarta-Commons Collections Component  blueArrow
10/23/2002; 11:19:00 AM (reads: 822, responses: 0)
Though to really get that functional feeling you also need operator overloading so that you can create function objects. As Ehud once pointed out this is just syntactic sugar, but a sweet one at that.

As I've mentioned in the past, my problem with STL "functional programming" is the lack of closures, which means all relevant external variables must be explicitly referenced by members of the function object. This results in lots of typing overhead.

Also as previously mentioned the Boost Lambda Library makes this a bit nicer.