Java Annotated Monthly – January 2016
Java Annotated Monthly – January 2016
All the latest interesting news and blogs around Java and the JVM languages, including the OpenJDK Android news and some thoughts from Mark Reinhold.
Join the DZone community and get the full member experience.Join For Free
As we turn the calendar on the Java Annotated, we predict the year ahead will bring enormous growth for Java. With lambdas and streams now firmly planted in the Java ecosystem, developers are starting to reap the benefits of functional programming and cultivating new breeds of reactive services and applications. As the largest, healthiest programming language in the world, Java is poised to make real headway in 2016 and already promises exciting innovation in runtimes, frameworks, tools and languages. Stay tuned on the Java Annotated and you’ll stay ahead of the latest developments and emerging trends every month, brought to you by JetBrains.
No other language runs on as many devices as Java. From Sega Genesis to smart homes, and mobile phones to mainframes, Java can be found in surprising places. But while Java is often the leading choice for businesses, it faces increasing pressure from newer languages like Python, and Ruby, which favor productivity over convention. Due to its scale and complexity, Java can be slow to innovate and late to adopt modern language features in manyareas. How Java evolves to these pressures in 2016-2017 will affect the future of Java applications for generations to come.
Java at 20 and Where We Are Going – Java Technology Lead Steve Elliot discusses the present and future of the Java platform, highlighting several key efforts to modernize the JVM including the removal of sun.misc.Unsafe and Project Jigsaw, paving the way for a more lightweight, container-friendly platform in Java 9. Meanwhile, even longer-term projects Panama and Valhalla aim to provide better C/C++ APIs and more advanced language features, but given Java’s delayed timeline we may not see the fruits of these labors until 2020 or beyond.
When your Java is broken – SDKs are tricky business. As large software projects are prone to be, the JVM is an imperfect machine. Even the owners themselves have difficulty patching Java. But sometimes the only option is to build a custom runtime, and this is where Infobip’s Milan Mimica writes from experience. Incidentally, the issue he fixes is a pretty common inconvenience. While hacking on the JDK may be easier than you think, maintaining patched JDKs while shipping production updates is considerably more difficult.
Closing the Open Door of Java Object Serialization – As Java Architect Mark Reinhold has freely admitted, Java’s Object Serialization is widely regarded as a bad move. Object serialization is fraught with implementation gotchas and security problems. Moreover, there are many excellent alternatives including the highly acclaimed library, Kryo. But security conscious Java developers would be well-advised to consider the implications of a naïve deserialization policy, one potential attack vector for gaining ACE (nb. there is an easy way to prevent such an exploit).
As Java programmers, sometimes we can overlook many useful languages that share the JVM ecosystem. These languages are crucibles for new programing techniques and language features like macros, null safety and reified generics that are unavailable to old-school Java developers. Whether Ceylon, Clojure, Scala or Kotlin, make a commitment to learn one of these languages in 2016. Try one for a weekend or for a new project and you will find new ideas that are guaranteed to broaden your horizons and simplify your life as a software developer.
Ceylon on Java 9 + Jigsaw – Ceylon previews initial support for the Java Module System. Why would you want to learn Ceylon? For starters, Ceylon has some pretty nifty language features like union and intersection types, unparalleled modularity (now in line with the upcoming changes in Java 9), and typesafe metaprogramming support (a topic we’re also quite enthusiastic about). But don’t just use Ceylon because it has neat features. Use Ceylon because it’s supported by some very smart folks at RedHat, and has an excellent set of developer tools to boot.
Clojure 2015 in Review – Clojure developer Stuart Sierra reviews the state of Clojure in 2015, with some notable highlights including the rapid growth in ClojureScript (a Clojure-JS Compiler), the release of Clojure 1.7 featuring Transducers, and the introduction of Cursive, a brand new IDE for writing Clojure. But why learn Clojure? Among other reasons, Clojure emphasizes the importance of immutability, an issue which Java developers are just starting to appreciate with lambdas and their interaction with variable capture and Java’s “effectively final” semantics.
Kotlin 1.0 Beta 4 is Out – Kotlin is a language we have grown fond of at JetBrains, and one that is beginning to take root in the wild. Kotlin 1.0 Beta 4 introduces an incremental compiler, updates to overload resolution, and refinements to Java wildcard support in addition to the usual assortment of IDE quick-fixes and intention actions. But why learn Kotlin? Take it from Nat Pryce, who values Kotlin’s type inferencing, enhanced FP support, operator overloading and type-safe builders. But not all is so rosy. If you have feedback about Kotlin, we would like to hear from you!
Scala eXchange 2015 – Sessions delivered at the fifth annual Scala eXchange, Europe’s largest Scala conference, feature insights from some of the world’s brightest Scala developers. As a Java developer, you may be wondering, “Why should I learn Scala?” Scala developer Clint Miller can help you in that department. In addition to Scala’s unrivaled collection of libraries and frameworks, Scala also has a full release schedule planned this year, starting with the release of 2.12.0-RC1 and the migration to Java 8 anticipated in late May.
- Scaling Intelligence: moving ideas forward with Jessica Kerr
- Ammonite: rock-solid shell scripting in Scala with Haoyi Li
- Count-Min Sketch in Real Data Applications with Laura Blėdaitė
- Distributed deep learning with Jan Machacek
- Finch: Your REST API as a Monad with Vladimir Kostyukov
- What are typeclasses and why you should care with Philip Wills
- Reactive in practice: web services with Scala and AWS with Matt Roberts
- Essential Slick: Hands On With Slick 3 with Dave Gurnell
JRuby+Truffle Update – Rounding out the pack, we have an update from the JRuby+Truffle research project, promising exciting performance improvements for the Ruby community. Originally conceived as a direct port of Ruby’s official C implementation, JRuby grew quickly as the fastest Ruby interpreter on the block. Meanwhile, Oracle has been working on Graal/Truffle, a dynamic compiler for JVM languages, built to rival native compilers. Now, Chris Season from the JRuby+Truffle project reports 10-300x speedups over JRuby. Details are also available.
These aren’t your grandma’s application frameworks. Today’s Java frameworks are easy to get up and running in an afternoon, and with the help of developers like Holger Steinhauer, Jue Wang and Ryan Paul, you’ll be well-equipped for writing Spring-powered web applications, building JVM microservices, and streaming database results without pouring over dense tomes of reading material. Productivity is the name of the game and when it comes to frameworks, the sooner developers can become productive with your tools, the happier they’ll be.
Blade, A Simple and Elegant Web Framework – Blade is terse web framework for Java that emphasizes concise, readable code and provides APIs for building RESTful web services and composing data pipelines without a whole lot of extra fanfare. Inspired by Rails and Play, it follows the MVC pattern and allows you to use several template engines to render HTML. You can route HTTP requests and create custom interceptors to filter and transform requests, and it supports plugins to help integrate with various database frameworks.
Using the official RethinkDB Java driver in other JVM languages – RethinkDB is a neat JSON database that enables a push-based programing style for streaming web apps. You can subscribe to something like a “view” in traditional SQL and have the results pushed back to you as they are updated in real time. Following the introduction of RethinkDB’s official Java driver last month, RethinkDB explores how to set up and configure the driver in Java 8, Groovy, Kotlin, Scala and Clojure in just under a few lines of code.
Java on Android continues to evolve in the midst of various trials and tribulations, but for developers, Android continues to drive the enormous growth and popularity of modern Java programming. Few languages offer the same opportunities for communicating with devices large and small, and that experience Android developers gain learning Java translates into building efficient Java applications on other platforms, making it a popular target for beginner programmers. With the amount of mobile code maintained in Java, this is unlikely to change in the near future.
Android will use OpenJDK for Java APIs – Speculation thickens in the Android community over an unobtrusive commit to the Android codebase 51b1b6997f, adopting code directly from the OpenJDK project. Citing the release of Java 8, and the introduction of new language features such as lambdas, this commit could signal the general availability of Java 8 features in Android N. Forward-thinking Android developers can find useful information for migrating to Java 8 right here (we have some experience).
Kotlin for Android Developers – Kotlin provides a host of useful features specifically for Android Developers. In addition to all the features Kotlin adds to Java (including lambdas and extension functions), we’ve built a custom DSL that helps reduce some of the plumbing associated with Android development. Antonio Leiva, author of Kotlin for Android Developers has all the important details. For a list of up-to-date open source Android applications that you can use to help get started writing Android apps in Kotlin, check out any of these great apps:
- Merlin by Abdo Daoud
- Kt2048 by Mathias Svendsen
- MaterialAudiobookPlayer by Paul Woitaschek
- Bandhook-Kotlin by Antonio Leiva
- kotlin-dagger-example by Damian Pelta
- redchain by Joel Drotos
- kotlin-android-example by Satoru Fujiwara
The Java community is brimming with good ideas. Each month on the Java Annotated we dive deep into the archives, and three years in the running we have never come up empty-handed. For more information about these topics, we encourage you to reach out to the authors directly, and they would be delighted to hear your feedback. If you have an article you would like to see on the Java Annotated, please let one of us know on Twitter @IntelliJIDEA and we will strongly consider it. Thanks for reading!
Low-latency painting in AWT and Swing – Our own Pavel Fatin spent some time meticulously tracking sources of latency from keyboards to monitor pixels to bring you a better typing experience in IntelliJ IDEA. But moreover, you can apply the same techniques to AWT and Swing applications to better understand the sources of visual latency and improve your users’ experience. Pavel also published a benchmarking tool to help analyze end-to-end visual latency for text editors. Further data and analysis is available for your reading and typing pleasure.
The Right Way to Use SecureRandom – Programmers have debated the best way to generate secure random numbers since before computers even existed. But believe it or not, secure random or pseudorandom number generation is an important step that is seldomly overestimated by crypto applications. The first step to understanding how SecureRandom works in Java 8, is by understanding common vulnerabilities to SecureRandom and being aware of the risks. This is where TypeSafe’s Will Sargent can help.
Published at DZone with permission of Breandan Considine , DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.