Java Annotated Monthly – November 2015

From mobile devices, to middleware, to enterprise applications, Java has played a crucial role in shaping the design of business software for over twenty years. But Java’s audience is both the means of its growth and cause its own captivity. When a programming language is used by nearly half the world’s developers, we seldom stop to ask, “Is there a better way?” There is no question the best years of Java are yet to come, but there is change afoot in the Java ecosystem. Looking toward the next twenty years of Java, we must carefully ask ourselves, where does it lead us?

jam_pic

Kotlin

The course of adopting a new language often requires a large investment in translating programming skills and source code. Traditionally this choice was a fork in the road for software developers – at JetBrains, we believe there is a Middle Way. Today, there is a language that grows with you, revealing powerful idioms and a flexible grammar. This language offers seamless interop with Java, and advanced language features from inherent null safety to smart type-casting. By combining the world’s smartest developer tools and nearly two decades of experience writing Java, we are pleased to introduce Kotlin, a very practical choice for your daily development needs.

Kotlin challenges the status quo of language lock-in. Built on open source software, with native interop for Javascript and the JVM, it places very few demands on developers. Firmly rooted in developer tools, it offers automatic language migration and helps anticipate programming intentions and refactorings, giving Kotlin the flexibility to evolve and improve. As a natural evolution of Java, Kotlin brings some of your favorite language features from Java, allowing you to use familiar patterns while suggesting improvements like stripping away semicolons, redundant types, and unnecessary brackets. Kotlin shows us a better way, but does not force us to take it.

Exploring Kotlin, you will find many delightful features, from string interpolation to operator overloading. Functional programmers will be pleased to find dedicated support for higher-order functions, tail-recursion and other useful FP concepts. But no matter your programming background, Kotlin gives you a vocabulary to be productive right away. Java developers will find unrivaled null safety, and with extension functions and properties, Kotlin lets you write flowing DSLs with the type-safe builder pattern, translating to fewer bugs at runtime, and more concise, readable code. Android developers will find a handful of utilities to help make their lives more pleasant.

This month marks the release of Kotlin 1.0 Beta Candidate, a journey that started at JetBrains over five years ago. To learn more, give it a try! Join hundreds of Kotlin enthusiasts on Slack, get practice writing Kotlin Koans, spark your interest with reading material for Android developers, and start your own journey with Kotlin today!

Java

This month we had the pleasure of meeting old friends and making new ones at the 20th inaugural Java convention in San Fransisco. Each year we count down the days to JavaOne, and each year we learn something new. This year, some of our favorite speakers taught us about hidden treasures in Java 8 with Venkat Subramaniam, how to design APIs with Java 8 Lambdas and Streams from Brian Goetz and Stuart Marks, and writing effective Java Streams with Paul Sandoz. That’s just the beginning.

Avid readers of the Java Annotated will already be familiar with a number of ongoing trends at JavaOne, starting with modularization in Project Jigsaw. For the uninitiated, three talks from the JDK leads offer an extensive introduction to Java modules, an upcoming feature available to preview in Java 9 builds today. In contrast with Java 8, preparing for Java 9 will require a number of language and tooling changes as well as the fairly controversial change to remove and encapsulate most internal APIs.

A recurring topic this year was Java’s return to user interfaces with a growing emphasis on mobile, both areas that have received serious attention in recent years after many years of stagnation, thanks the heroic efforts of JavaFXPerts and newcomers alike. Oracle/Java has reaffirmed its commitment to supporting rich UI applications, by providing JDK Ports to Modern Mobile Platforms and spotlighting key JavaFX contributors like Gluon and RoboVM, in an effort to bring cross-platform Java applications to more consumer mobile devices.

For a full list of talks and corresponding slides from JavaOne, many of the sessions are available through JavaOne Live, and on the JavaOne session catalog.

Android

While the reactive programming paradigm has found new life in today’s era of microservices and distributed computing, web applications are not the only area that has benefitted from reactive. Enthusiasm for reactive patterns has carried into neighboring programming domains, including user interfaces, Kotlin programming and even the OpenJDK project, so it was only a matter of time before Android developers were able to convince themselves the virtues of reactive programming. Despite skepticism among certain circles, many developers and teams have been able to apply RxJava and RxAndroid to compelling effect, including Juan Gomez at Netflix, and Matthias Käppler at Soundcloud.

RxJava does have certain caveats, in the form of performance overhead and more importantly, the issue of debugging. With added layers of indirection comes increased complexity at runtime, generally making stack traces completely unreadable. This is a problem currently being addressed, underlining the importance of building developer tools and frameworks hand-in-hand. While there are many options available for Configuring Android Studio, unfortunately there is no Auto-Debug option. Instead, you must log all the things.

In other news, there is now a very useful plugin for running ADB over wi-fi.

Develop with pleasure!

This entry was posted in News & Events and tagged . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *