The week in Java

Java Weekly 48/15: Jigsaw and OSGI, FP in Java, Arquillian

Thorben Janssen
News image via Shutterstock

How does Java 9’s modularity compare to the OSGI module system? Is it good to set goals for code coverage? The latest Thorben Janssen brings us the latest news and essential reading from the Java world.

This post originally appeared on Thorben Janssen’s Java EE blog, where Java news is published weekly:

Functional programming is nice and it gets even better as soon as you start to create higher order functions, right?
Well, I completely agree with the first part of the statement but the second part makes me a little nervous. Don’t get me wrong, higher order functions are very useful but they also provide a very easy way to implement memory leaks as Lukas Eder points out in his recent post: Beware of Functional Programming in Java!

Java 9

Modularity seems to be the most popular part of Java 9 on the internet and it is also quite popular at conferences. In her recent post, Yolande Poirier highlights four talks about Java 9 modularity at Devoxx Belgium. If you haven’t already seen them, you should have a look at the youtube recordings: Modularity in Java 9.

If you are interested in Project Jigsaw, you already know about its shortcomings compared to the OSGI module system. It will be an improvement compared to the existing monolithic runtime, but it misses some key features, like versioning. Therefore Neil Bartlett tried to run the OSGI module system on top of a modular Java runtime to combine the smaller runtime with the more advanced module system: OSGi and Java 9 Modules Working Together.

Java EE

Roberto Cortez wrote a nice post about migrating a Java EE application from JBoss AS 4.x (Java EE 5) to Wildfly 8.2 (Java EE 7). Migrating a Java EE application from an old server version to a new one shouldn’t be a big deal, even if the server was renamed in the meantime. But that changes quickly, if you missed out on 4 mayor releases.

SEE ALSO: WebLogic application server now compatible with Java EE 7

If you have to do a similar migration (or just want to read about the good old days…), have a look at Roberto’s post in which he describes the main issues of the migration: Application Server Migration: JBoss EE 5 to Wildfly EE 7.

This and that

Measuring code coverage is in general a good thing but you should not set a goal for it. It provides the wrong incentive and can have a bad impact on your code quality, as Mark Seemann describes in his post Code coverage is a useless target measure.

Testing Java EE applications can get complex. If you want to do real tests which include the used container services, you need to run them within the specific container. That makes these tests much more complex than simple unit tests. One option to handle the additional complexity and to run your tests within a specific container is to use Arquillian. If you are not already familiar with that framework, you should have a look at Alexander Bischofs introduction: How To Use Arquillian.

Thorben Janssen
Thorben is a senior developer and regular Java blogger with more than 10 years of experience in Java EE development and architecture. During these years he has acted as developer, architect, project and technical lead to create high available, clustered mobile billing solutions and laboratory information management systems.

comments powered by Disqus