Functional can be fun you guys


In which Voxxed probes the mind of Richard Warburton, author of Java 8 Lambdas and Java 8 Training Partner, for his thoughts on present and future incarnations of the platform, Oracle’s modest attitude to J-9 modularity, and why Swing may have missed the boat on mobile. Read on, then, for full-strength Warburton-flavoured Java hit, check out his blog,, which offers pretty much what it says on the tin.  

What do you think people are most curious about when it comes to Java 8?

I think I’ve had a few people asking about whether or not it’s easy to get started with stuff….Some people are worried about getting their colleagues to adopt it or people in different teams…and I think some of the more functional programming ideas have a bit of a bad rep. That community is very elitist, and not so strong at reaching out to the wider community.

I gave a [JavaOne] talk on “Twins: Functional programming and object oriented programming”, that had a good set of attendees, and one of the things that I thought was interesting was that, when we were talking about bigger picture trends for Java developers, you’re beginning to see a lot of these new ideas and a lot of the new architectural patterns already featuring a lot of functional ideas.

A lot of people are using immutable classes already, a lot of people are using things like composition over inheritance – a more functional approach to modelling their data – so it’s good from the perspective of going out and doing that talk that the ideas you’re pushing already have some kind of traction, but at the same time it’s also kind of surprising that it’s already out there, it’s ahead of where you thought it would be – but it’s surprising in a good way.

And traditionally there’s that tension with Java and functional programming communities…

There’s some tension yeah. But I think that once people get down to it, they’re OK with that, and they’re quite happy with the tech, and quite happy that it’s easy to get going and working with. And I think once they reach that point, a lot of them have the issue of trying to figure out how they’re going to introduce it to their company. A load of people who do Java are still on Java 6, not even 7, despite the fact that Oracle’s end-of-lifed 6, and I think there are a lot of people in that situation where they’re on 6, and they maybe even want to skip 7 entirely, and jump straight to 8.

I did actually read a survey by RebelLabs that said more people are going to jump to Java 8 instead of upgrading to 7.

I suspect so. It probably depends on where you’re coming from. I’ve seen some of the numbers on people doing things like cloud deployments with Java where they are a bit more up to date already, so most of them are already on 7, but I think many enterprises are still on 6 and will just jump straight to 8, which will be interesting. A lot of people have those problems where there are different libraries and frameworks where they’ve just got that backlog of things – so there are a few people who just have those adoption type issues, but these will be resolved over time.

There are a few standard questions that you see people come up with, like are lambdas in Java 8 genuine closures? Just for background: when you say a closure, you mean variables and the surrounding scopes. Technically…it’s actually a more idiomatic functional programming way of things to discourage mutability of variables in the surrounding scope, and encourage you to always be transferring and transforming and never to be mutating. So I think there’s that kind of thing that crops up as well, the little subtle semantic issues. So those are all fun.

Apart from lambdas, what other aspects of Java 8 do you most often get asked about?

Definitely the Date and Time API, which I also helped write a little bit of. It was actually a very strong London project – the spec lead Steven Coleborne was from London – and there was a lot of work done by him. A lot of help from people in the LJC as well. Obviously Oracle were incredibly helpful in pushing it all over the final hurdle. Yeah, Date and Time libraries too. It’s obscene how many bugs you get in Java related code.

Before the new Date and Time library, you might see people just trying to create a date, and they’ve got a new date object, and they’ve got to pass three parameters in. One’s for the year, one’s for the month, and one’s for the day, and you’d think that if you altered say the 12th of December, 2012, you’d pass in 2012, 12, 12. Now this would expose a huge number of bugs in your code. The year is not starting at 0 – it starts at 1900. So if you parse in 2012, you’d get the year 3912 – except that the second parameter you’d parse in would be the number 12 – which you’d think would represent December, right? December’s the 12th month. But months are zero offset, so if you put in 12 as the month, you don’t get December – you get January of the following year. Then, having months that are 0 offset in the API, you’d get to days, which start at 1. So you’d get the 12th of January in the year 3913.

And these kind of inconsistencies – lots of bugs out there, lots of things which are subtle, lots of things where people write unit tests where people only test the happy path, and it’s really interesting to see the new Date and Time libraries coming through JSR 310 that are much more consistent, much less error prone. It’s not a sexy feature, it’s not lambdas, but it’s one of those things that genuinely has a lot of business value – a lot less bugs, a lot more reliable code, and it’s something that loads of people have to deal with.

Jumping off on that point about big sexy features, I found it quite interesting that Oracle wanted to de-emphasise the importance of modularity in the keynote compared to lambdas, even though it seems to be the headline feature of Java 9. What did you make of that?

I think that’s an interesting observation. If you look at what modularity brings to developers, there are different possible use cases, and different possible people who could benefit. Ultimately, you want to benefit developers, but whether it’s a direct or indirect benefit to developers is quite a different thing. When Project Jigsaw was around for iteration 1, it sounded like  a lot of motivation was involved in using modularity both for the JDK and for end user source code. It’s quite a complicated project – there’s a lot of ins and outs of doing it both ways, but I think it sounds like the new Jigsaw version has been refocused in scope to be more about modularising the JDK, and to strip down some of the outside of the JDK use cases.

It’s all useful for front end developers, it means they can ship a JDK around, which is smaller and more lightweight, but it means that perhaps while they still will use Jigsaw, they won’t see Jigsaw as being the complete solution to the modularity within their application.

I think that Oracle are right to start  the message already, that the new Jigsaw version is more about modularising the JDK – but I think that’s a good thing in itself. If you look at new versions that people are doing, they’re doing a lot more continuous delivery, a lot more continuous deployment, and you even see people doing things like immutable servers so they never make any change to their server configuration, they just destroy it and bring a new one up, and the reason that people are doing that is you don’t get the temptation to leave small hacky things lying around on your server. Everything has to be clean and fresh.

When you’ve got something like the JDK though, what it does mean is that you’ve got a whole load of other overheads to regenerate, so something like Jigsaw plays into these new trends really well by allowing people to have a much more narrowly focused JDK installed which is then much quicker when they start doing the server rebuild – so I think a lot of the Jigsaw modularity cases, as well as benefitting developers, they’re more for the JDK guys, and they’re also quite beneficial to people like SysAdmins, DevOps people, people who are actually doing all the deployments and delivery sides of things. It’s quite interesting.

What do you think of Oracle’s big push on mobile and JavaFX at this year’s JavaOne?

I don’t really know what the state of play is with JavaFX on mobile – I know a few people using JavaFX on desktop applications, and I’ve run an open source project myself which uses JavaFX for desktop applications absolutely fine – it works well, better than Swing – it’s quite a nice platform to develop for, but I really don’t think it’s fitting into bigger picture trends on mobile.

A lot of people on mobile these days are doing things like writing HTML5 code, and then wrapping it up in lightweight apps – so they’ll still use the fact that there’s an app store to deliver to their customers and get the PR push, and they still want to do things like interact with on-device features like camera and GPS  etc., but for a lot of people it’s just an easier situation for them to be writing a website which a lot more people know how to write than trying to do rich client development anyway.

And even if you are doing rich client development, the emphasis and the main motivation people cite, is being able to get the best experience possible on that platform. So for that, you probably want to be writing directly for Android or iOS. To literally maintain multiple code bases for your app is very expensive, and it might not be worth the benefits – but if you’re going to go native, you might as well go the whole hog.

You also did a JavaOne session on how to make your JUG more awesome. There’s definitely been a concentrated effort on the part of Oracle to acknowledge the work of the community  – possibly a little belatedly – and how crucial it is for Java going forward. The JCP seems to be getting a lot more attention these days too. What do you think stops people getting involved in the Java community and participating?

I think it’s worth noting that, at a lot of these things, even though it’s a lot of ‘Java, Java, Java,’ the community stuff is actually a people engagement thing. So it’s a few people running JUGs, they do talks and things, but there aren’t a lot of bonding type activities. I think a lot of it may be down to that lack of personal touch. I think that Oracle themselves are actually doing a really good job from a technical perspective of helping the community.

When I was writing my book  (Java 8 Lambdas), I had huge amounts of support from the guys writing the program – and those guys have come over to community events, the LJC have run a few Hack Days, a few events relating to Java, and they’ve always been really supportive of that.  But, I guess Oracle as a company, if you just think of its nature, it’s not really a company that’s very used to, or experienced at community action in that regard. It’s a learning process.

Image by grant rambojun

“Ultimately, you want to benefit developers”: Richard Warburton on Java 8 and beyond

About The Author
- Editor of, focusing on all things Java, JVM, cloud-y, methodical, future-fantastic, and everything in between. Got a piece of news, article or tutorial you'd like to share with your fellow Voxxians? Drop us a line at

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>