News

Java Annotated Monthly – September 2014

The Java Annotated Monthly is your one source for the latest developments from the Java community and beyond. Each month, we highlight the most interesting content around the web, from developers like you. This month’s issue is dedicated to Robbie Cheng, author, OSS contributor, and Java community leader. Our thoughts go with his family and friends.

jam_pic

Java

With its steady development, meticulous design and huge selection of libraries and frameworks, the Java language is a natural choice for large and small projects. Today, development shows no sign of slowing down, with new JEPs arriving each month and a brand new update just in. Find your reason to start using Java today.

Oracle Java Development Kit 8, Update 20 – Java’s latest major revision introduces several features starting with string deduplication, a new management console, JMC updates, runtime heap resizing and much more. For a full list of features in JDK 8u20, head over to the release notes and check out the new documentation.

Java EE 8 Takes Off – All aboard the Java 8 express, next stop, EE! Java’s next release train has left the station carrying support for the latest web standards, alignment for contexts and dependency injection, a brand new model view controller and Java SE 8. Java EE 8 is schedule to arrive during Q3 2016.

First batch of JEPs proposed to target JDK 9 – Mark Reinhold announces the first group of JDK 9 enhancement proposals, with improvements to the Process API, contended lock handling, code cache segmentation, a dedicated JSON API, smarter Java compiler and modular source code, one of several JEPs under Project Jigsaw.

Money is coming to Java 9 – Handling money has been a pain point for Java developers since the very beginning. With Java’s steady adoption in the financial services industry and the growth of mobile and embedded payment systems, JSR-354 will become a key feature in Java 9. For more information, check out the maturing API at JavaMoney.org.

When to use parallel streams – Doug Lea, instrumental figure behind the creation of Java’s fork/join framework, JSR-166, and recently JEP-188, offers some advice from the trenches on using parallel streams, a choice that may lead to unintended side effects.

Generics: How They Work and Why They Are Important – Josh Juneau explains the benefits of generic types and how they can be used together with lambda expressions in Java 8 to enforce type safety and help adopt functional programming.

JVM

The JVM is a truly amazing piece of technology. Today, more and more language implementors are choosing the JVM with its powerful instruction set, cutting-edge GC, access to Java tools and libraries, and advanced compiler optimizations. This month, we have five language resources for the JVM polyglot from Clojure to JRuby.

Getting started in Clojure with IntelliJ, Cursive, and Gorilla – Jonathan Hudson has put together a step-by-step introduction for getting your favorite IDE to work with Cursive Clojure, Leiningen and the Gorilla REPL to support Clojure development.

Erjang with the JVM Under the HoodErjang is an Erlang VM built on Java. Kresten Krab Thorup is its author. One day he decided to learn Erlang. So Erjang was born. In this talk, Kresten discusses implementing a compiler and virtual machine in Java that trades BEAM’s soft real-time guarantees for higher overall throughput.

Making the case for Jython – Agustín Bartó, Java developer turned Pythonista argues why Jython is an important part of every data wrangler’s arsenal, by combining the performance and maturity of Java with the simplicity and expressiveness of Python.

The Unpuzzling Kotlin: Bringing Clarity to Your Code – Join our very own Svetlana Isakova and Alexey Sedunov as they unravel Kotlin in a series of exercises based on the highly acclaimed Java Puzzlers, designed to help you write cleaner, clearer code.

Ruby from the comfort of the JVM – Most Ruby folks agree that JRuby is the fastest Ruby runtime, thanks in part to some wicked smart compiler optimizations. But the real benefit of using JRuby is access to Java libraries and frameworks – Alex Soto from RebelLabs gives us all the nuts and bolts for running Ruby and Java side by side. Once you’re comfortable, dive into the deep end with JRuby lead, Charles Nutter.

JVM Language Summit Talks – Talks from this year’s annual JVMLS are up, featuring ideas from some of the best and brightest developers in the Java language community.

Frameworks

Three centuries ago Isaac Newton wrote, “If I have seen further it is by standing on the shoulders of giants.” One pillar of Java’s success has always been its great selection of frameworks, allowing us to leverage millions of lines of code with just a little know-how. Here’s what you need to know, and how.

Spring 4 on Java 8 – Java 8 and Spring 4 are a natural fit, and this is by no mistake. In this presentation Juergen Hoeller describes how programming idioms in Spring 4 complement Java’s functional style and how you can use it to build leaner Spring applications. Juergen is co-founder of the Spring Framework.

Spring Framework 4.1 GA – The latest release of Spring Framework includes several new features including the newly minted JCache specification, MVC improvments, annotated Java Message Service listeners, websocket refinements and more. Spring Framework 4.1 is now the primary maintenance branch.

Vaadin Framework 7.3 – Our friends at Vaadin have put a lot of work into making your web apps shine with a brand new visual theme, Syntactically Awesome Stylesheets, and a fresh Eclipse plugin. Classes and widget sets should be recompiled with the latest version in order to take advantage of these features.

Ninja web framework – Ninja is a community-run, full stack, MVC web framework for Java, based on established tools and technologies, ex. Servlets, Guice, JPA, Flyway and Maven. Some features include native session and security management, XML/JSON parsing and rendering, mocking, and integration testing, all in the tradition of Rails.

State of Netty – Trustin Lee is the main contributor to Netty and estimates a hundred million people are currently using it for everything from instant messaging to high frequency trading. Learn about Netty’s current direction and how you can use the client-server framework to maximize network performance in these two talks.

JUnit in a Nutshell – This outstanding tutorial from Frank Appel covers the fundamentals of test driven development on JUnit with proper test structure, test isolation, and test runners. Learn how to get up and running with plenty of examples and best practices.

Reactive Actors in Java – Akka is an open source toolkit for writing reactive applications on the JVM using the Actor model. Jump into action with Akka and learn all about Actors, Routers, Futures, Clusters, Lambdas and how you can put them together to write event-driven, cleaner and more expressive code using Akka.

Apache Hadoop 2.5.0 – Hadoop 2.5.0 is a minor release with some important features including authentication improvements, native Graphite support, extended attributes in HDFS, and REST API updates for YARN. See the release notes for more details.

Accessing Cassandra from Spark in Java – Spark and Cassandra, two frameworks for distributed computing and storage can now talk to each other, thanks to the newly open sourced spark-cassandra-connector, allowing you to filter and roll-up data in Cassandra, then send it over to Spark for really fast data processing.

Getting Started with MongoDB and Java – Trisha Gee, Java engineer at MongoDB, gives a great introduction to MongoDB, starting with installing the Java driver, setting up a connection and working with documents, then takes a look at a few Object Document Mappers. Part two dives into CRUD operations, with code available on GitHub.

Mobile

Java is not just for the big application server, three billion mobile devices run on Java too. But developing for mobile is seldom hands-free. We will need all the help we can get, from smarter developer tools to safer APIs and frameworks. Together, we can help build better software for the next generation of mobile devices and applications.

Kotlin, the Swift of Android – Mike Gouline has written a guide to building Android apps with Kotlin. Since Kotlin compiles down to bytecode, and the Android compiler reads bytecode, like other JVM languages, it works quite with Android. One of the benefits of using Kotlin is its relatively small runtime compared to Scala and Groovy.

Getting Started with Android L Animations – Paul Trebilcox-Ruiz gives us a few ideas for using new animations features released in the Android L preview, from element animations to activity transitions and shared element activity transitions. Give these animations a try in the Android Studio Beta preview today.

Putting Your APKs on Diet – One issue that has troubled Android developers for a long time is the 65,535 method limit. Now this may seem high, but can be problematic when using large libraries. Yet this ceiling forces developers to watch their resources and in addition to tools like ProGuard and Lint, help keep your applications trim and tidy.

Architecting Android Applications with DaggerDagger is a dependency injection framework for Android and Java. All the code is generated and validated at compile time, making it especially well-suited for mobile, since it does not rely on reflection. Jake Wharton lays down the basics of building better Android apps with Dagger.

Open Source

Java developers commit millions of lines of code to open source projects each month and are a cornerstone of the OSS community. Contributing to OSS is one of the best ways to become a better developer and help others too – any of the following projects are great places to start and would gladly welcome contributors.

AngularFaces 2.0 – AngularFaces is a JSF library providing easy AngularJS integration in Apache MyFaces, Oracle Mojarra, PrimeFaces and HTML5. In this article, Stephan Rauh guides us through some of the new features in AngularFaces 2.0.

JHipster 1.0 – The JHipster Yeoman generator aims to combine Java, Maven, Spring and AngularJS into one web application framework with Yeoman, Bower and Grunt on the client to create Spring MVC-based webapps with full hot code swapping. Cool!

Flyway – One common problem when writing relational database software in an agile setting is handling schema migrations, and replicating them across development, staging and production servers. Axel Fontaine is the creator of Flyway, the agile database migration framework for Java.

QuickML – Ian Clarke releases QuickML, a machine learning library that includes a decision-tree learner, random forest implementation, cross validator, and meta-optimizer to help bootstrap and test supervised ML in pure Java.

WalnutiQ – WalnutiQ is a Java-based implementation of hierarchical temporal memory developed by Quinn Liu, undergraduate and neuroscience enthusiast at Virginia Tech. WalnutiQ is based on Jeff Hawkins’ work at Numenta, a startup working on strong AI.

ActiveMQ 5.10.0 – ActiveMQ introduces support for Java 8, a new runtime for Apache Shiro, better security protocols and improvements to runtime configuration and web console. For an introduction to message brokers check out Exploring message brokers.

Para – Para is a back-end framework for object persistence and retrieval on the cloud that can be used to store objects to a datastore or RDBMS. It can be deployed as a standalone JAR or as a REST API service.

jFairy – JFairy generates fake data for testing purposes. It is available on a Maven repository and can be configured to use a number of sample locales.

EJML – The Efficient Java Matrix Library has released a new equations API for symbolic manipulation of simple linear algebra expressions, one alternative to more complex computer algebra systems like Matlab.

CodeExchange – A search engine for Java code. Check out a few examples for how you can use CodeExchange to help you avoid reinventing the wheel. Also a good option for quickly looking up source code in a library without downloading the whole thing.

Time4J – Meno Hochschild releases Time4J, a first-class alternative for JodaTime and Threeten designed for scientific applications. Time4J supports leap seconds and historically accurate dates.

Imcache – Imcache is a Java Caching Library from Cetsoft that supports on- and off-heap caching and existing solutions like memcache and redis. Imcache includes a simple API and query mechanism to help you write high performance caching.

Performance

Java performance has come a long way in the last ten years with advanced compiler optimizations and ongoing work to enlist the latest CPU and GPU architectures. Don’t let anyone tell you Java is slow. Except assembly programmers. And maybe C folks. We’ll give them a pass.

JMH 1.0 – Celebrate the official release of JMH in style with Aleksey Shipilëv, the culmination of seventeen months of hard work and hundreds of commits. The Java Microbenchmark Harness shares the combined benchmarking wisdom from dozens of leading experts, to help you easily profile low-latency code.

Developing Real-Time Software with Java SE APIs – Java is not always the first choice for real-time programmers due to “stop-the-world” pauses in Hotspot, but there are certain virtual machines designed to operate under hard real-time constraints. Kelvin Nilsen takes us through implementing an automobile traction control system for Java.

Time-memory tradeoff with the example of Java Maps – Roman Leventov profiles HashMap using several popular collections libraries, with some interesting results. Benchmarks run on a SandyBridge with 128GB RAM. HTFC appears to be the frontrunner in these tests, raw data is also provided.

How to find and fix memory leaks in your Java application – Leo Ufimtsev at RedHat describes how to use the VisualVM to diagnose memory leaks in Java. You can also use cloud-based services such as Plumbr to help quickly detect and respond to memory leaks in a production environment.

All Accesses Are Atomic – One day, locking may be largely a thing of the past. When using atomic data structures and lock-free algorithms, locking on shared state becomes unnecessary. Aleksey Shipilëv explores the repercussions of replacing volatile primitives with atomics on several platforms, with some encouraging results.

Community

Java’s community is a wellspring of new ideas. If you have an article you would like for us to review, please contact us by twitter or email and we would be happy to take a look. Meanwhile, join us as we explore some outstanding articles from this August.

How to build a Spring Boot application using IntelliJ IDEA – Patrick Grimard has a great introduction for setting up Spring Boot in IntelliJ IDEA, with source code available on GitHub.

Predicting the next Math.random() – Franklin Ta blogs about reverse engineering java.util.Random’s linear congruential generator to brute force the seed and predict subsequent values by inspecting a single output. Writing crypto? Use SecureRandom!

ZooKeeper for the Skeptical Architect – Camille Fournier delivers a high-level technical overview of Apache Zookeeper, a centralized service for helping coordinate distributed systems using consensus algorithms like Paxos and Raft.

Dagger 2, A New Type of dependency injection – Gregory Kick explains how he helped fix Dagger to make it more IDE-friendly with find usages and debugging, eliminating all reflection and completely using compile-time validation for the object graph with large performance gains to boot.

Why is it so hard to make a Java program appear native? – Making a Java UX appear native across many platforms is surprisingly difficult, and something even IntelliJ IDEA struggles with.

Value Objects in Java and Python – Steve Wedig has a great article on what Java can learn from language design in Python, in anticipation of Java planned addition of Value Types.

Six built-in JDK tools the average developer should learn to use – The JDK is full of useful tools and Oleg Shelajev introduces us to a few you may have never even heard of.

StringJoiner in Java SE 8 – Stephen Colebourne, JodaTime creator and JavaMoney contributor, compares the benefits of using StringJoiner in Java 8 with Guava’s Joiner implementation.

JavaOne 2014 – JavaOne is right around the corner! If you are attending the conference this year, here is a great way to plan your stay in the bay, compliments of Java Community Manager, Tonya Moore. Stay tuned for next month’s coverage from JavaOne.

image description