BT

New Early adopter or innovator? InfoQ has been working on some new features for you. Learn more

The Road to Javaslang 3.0

| by Michael Redlich Follow 5 Followers on Nov 12, 2016. Estimated reading time: 4 minutes |

Javaslang, an open-source functional library that provides persistent data types and functional control structures for Java 8 and beyond, published a version 3.0 roadmap scheduled for March 2017:

Javaslang 3.0 roadmap

Javaslang was created by software developer Daniel Dietrich and first released in 2013 to coincide with the early release of Java 8. It leverages Java 8’s lambdas to “create various new features based on functional patterns” with the intent to replace Java’s standard collections with a functional collection library.

In a recent interview with jOOQ (Java Object-Oriented Querying API), Dietrich explained his vision for adding object-functional programming style to Java:

I think that many users were disappointed about Java 8 in the whole, especially those who are already familiar with more advanced languages. The Java language architects did an awesome job. Java 8 brought groundbreaking new features like Lambdas, the new Stream API and CompletableFuture. But the new abstractions were only poorly integrated into the language from an API perspective.

 

Object-functional programming is nothing new. It is the best of both worlds, object-oriented programming and functional programming. Scala is one of the better choices to do it on the JVM. Java’s Lambdas are an enabling feature. They allowed us to create a Javaslang API that is similar to Scala.

Michael Feathers, founder and director of R7K Research & Conveyance, once tweeted, “OO makes code understandable by encapsulating moving parts; FP makes code understandable by minimizing moving parts.”

Previous version 2.0 release

Version 2.0 focused on interoperability with Java 8. With over 1900 commits, significant features included:

  • New interfaces, Future and Promise, for concurrent programming.
  • A new pattern-matching API.
  • New collection types.

Javaslang 2.0 library hierarchy

A more recent Javaslang blog demonstrated how to use the new pattern-matching API along with a preview of additional API methods for the upcoming version 2.1.0:

Javaslang pattern-matching example

Javaslang 2.1.0 examples

March 2017 version 3.0 release

While the version 3 changeset is being planned, the development community is encouraged to participate in Javaslang’s Gitter discussion, peruse the formal list of proposals, and contribute.

Dietrich spoke to InfoQ about the road to version 3.0:

InfoQ: What sets Javaslang apart from other functional libraries, like jOOλ, StreamEx, and Cyclops?

Daniel Dietrich: Javaslang aims to bring as much as possible of the Scala goodness to the Java language. That is *the* unique selling point. There is no reason to reinvent the wheel and create new concepts for problems that are already solved. We benefit from aligning to Scala for the following reasons:

  • Some of the basic ideas behind Scala are also valid for Javaslang, for example the similar persistent collection hierarchy.
  • The learning curve is smooth. Using Javaslang should be easy for those of us who are already familiar with Scala. There is much Scala documentation available that is also valid for Javaslang, especially on how to solve common problems with the collection library (e.g. on Stack Overflow).
  • Javaslang is more expressive/concise than plain Java 8 and might also be faster than Java 8’s Stream (see benchmarks of our upcoming Vector: https://github.com/javaslang/javaslang/pull/1557).

 

jOOλ and StreamEx contain utility functions, they work well for making it easier to use Java 8’s Stream. But users still have to write unnecessary, noisy code. More lines of code correlates to more errors.

 

Cyclops is a niche library for distributed programming but not as popular as RxJava and Akka. It looks a little bit like a playground for functional-ish features, like stackless recursion with trampolines and lifting of monadic types. These are not practical in Java, and intentionally these features were not included in the Javaslang core.

InfoQ: Does the delay of Java 9, now scheduled for July 2017, affect your planned release of Javaslang 3.0 in March?

Dietrich: Javaslang will stay backward compatible to Java 8. New Java features that will influence the Javaslang API will be shipped with Java 10. So I currently see no reason why the delay of Java 9 should affect the release date of Javaslang 3.0. However, there are already changes to the roadmap.

InfoQ: Are there any updates you can share on the release of Javaslang 2.1.0 and/or the roadmap to Javaslang 3.0?

Dietrich: The development and testing of the new Javaslang features will take more time. We will make a public BETA version of Javaslang 2.1.0 available at the end of this year. The work on Javaslang 3.0 will be started after the release of Javaslang 2.1.0 to reduce friction losses. To compensate the delay of 3.0, we will include some features into 2.1.0 that were originally targeted for a posterior release. A complete list of features can be viewed on our project site https://github.com/javaslang/javaslang.

 

Javaslang 2.0.x is already pretty mature, so we will take our time to get 2.1.0 right. I currently cannot tell an exact release date but I want encourage our users to start testing the BETA version and release candidates as soon as they are available.

 

Javaslang 3.0 will not be backward compatible to Javaslang 2.x. From the user-perspective the upcoming 2.1.0 release is more interesting regarding existing code bases that already depend on Javaslang. The 3.0 release will be the future of Javalsang.

Resources

Rate this Article

Adoption Stage
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread
Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Discuss

Login to InfoQ to interact with what matters most to you.


Recover your password...

Follow

Follow your favorite topics and editors

Quick overview of most important highlights in the industry and on the site.

Like

More signal, less noise

Build your own feed by choosing topics you want to read about and editors you want to hear from.

Notifications

Stay up-to-date

Set up your notifications and don't miss out on content that matters to you

BT