Skip to content

Curry Saves Java?

nerds-central.blogspot.com
1 pointcode-dog3 comments
On HN

Comments

This programming style is commonly known as applying a "fluent interface" or fluent api. See Wikipedia http://en.wikipedia.org/wiki/Fluent_interface.

It is already heavily used by numerous Java frameworks like Hibernate (Criteria API, now part of JPA2), Apache Camel, and various mocking libraries like EasyMock and Mockito.

Concerning the SQL example in the blog post, there are quite a few Java libraries available that provide a fluent interface for building SQL. For an overview see http://stackoverflow.com/a/6565369.

Nice links thanks. Would you agree that there is at least a similarity in purpose between Currying in functional languages and fluent interfaces? It seems to me that techniques and ideas from partial application and currying are useful in the design and implementation of fluent interfaces.

I agree there is some similarity. Also other functional concepts like closures (although not available in Java) are useful in building fluent interfaces.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.