Fear multicore apps? Reactive programming to the rescue

Java is fast becoming a platform for coding programs that react to events rather than simply executing a string of commands

Page 2 of 2

InfoWorld: What's the link between asynchronous programming and reactive programming?

Suereth: I use them interchangeably. The only thing asynchronous means is when an event happens, I do something else. So asynchronous and reactive, by definition, are effectively the same.

InfoWorld: Talk about your JavaOne presentation.

Suereth: Basically we're going to go through the motivation for why reactive matters on Java. Fork/join enables us to do this efficiently. We have multicore programs. We need to fragment things out. Then we're going to step through some Java 8 features that you need to make use of for reactive. That's the Lambdas and the method handles and the functional interfaces.

InfoWorld: There is a lot of talk about Lambda being the most revolutionary change in Java. Do you see it as a revolutionary change, and how does it apply to reactive programming?

Suereth: Yes. I would say it's a revolutionary change, and I think it's what enables reactive programming to be elegant in Java. [Currently, with the Java Swing framework] you would make event handlers so that when somebody clicks a mouse, you do an action. You had to instantiate an anonymous class that had a single method.... It was a big block of code. It made things a little harder to maintain. With Lambdas, you fix two problems. One is the syntax. You bring the syntax for this style [of] code down to something that is easier to look at and understand what's going on. And the second thing you do is actually about scoping. You can actually reference variables inside the same scope without confusing what this is, this being the current instance.

InfoWorld: What is Typesafe's big interest in reactive programming?

Suereth: We actually have a reactive programming platform. All of our tools that we provide really promote and feature reactive programming.

InfoWorld: Does reactive programming apply to JavaScript or .Net languages?

Suereth: Yes. .Net has something called the Reactive Extensions APIs. It's nice and elegant and if you're doing Windows UIs, it's actually really easy to consume Web services and feed things into the UI itself. Node.js [leverages reactive programming]. Typesafe recently released the Reactive Manifesto in coordination with Eric Meijer from Microsoft, and the Node.js guys have gotten involved as well. It's a description of what reactive programming is.

This story, "Fear multicore apps? Reactive programming to the rescue," was originally published at InfoWorld.com. Get the first word on what the important tech news really means with the InfoWorld Tech Watch blog. For the latest developments in business technology news, follow InfoWorld.com on Twitter.

| 1 2 Page 2
From CIO: 8 Free Online Courses to Grow Your Tech Skills
View Comments
Join the discussion
Be the first to comment on this article. Our Commenting Policies