Skip to content
0:00 / 0:00

#java8#optional#apidesign

Optional by Stuart Marks

Devoxx

172K subscribers • 64 videos on Hallway • Conference channel

YouTube
  • Recommended by 2 people: 2 in engineering communities.
  • Presented by Stuart Marks, Principal Member of Technical Staff at Oracle

Intermediate. Assumes working knowledge.

33K views9 years ago2 recommendations

Programming languagesSoftware designJava and the JVMAPI designDesign patterns

Stuart Marks explains the design goals, proper usage, and common antipatterns of the Optional API in Java.

The Optional class was introduced in Java 8 in order to solve a narrow but frequently occurring problem: what to return if you have nothing to return. It is a single class with less than 20 methods, but it turns out to have been one of the most controversial and most misunderstood APIs, having generated several "centithreads" of discussion on OpenJDK mailing lists. Indeed, Brian Goetz (Java Language and Libraries Architect) has mentioned that one aspect of Optional was his biggest mistake in Java 8. Optional is also one of the more widely misused APIs. A brief survey of OpenJDK code revealed several embarrassing examples of Optional usage, and expert Java programmers have admitted to not making the most of this API. This session covers the history and rationale of Optional, provides recommendations and examples of proper and effective usage, shows several antipatterns and code smells and how to fix them, and finally describes some current and proposed work on Optional for Java 9. Stuart Marks is a Principal Member of Technical Staff in the Java Platform Group at Oracle. He is currently working on a variety of JDK core libraries projects, including Collections, Lambda, and Streams, as well as improving test quality and performance. As his alter ego "Dr Deprecator" he also works on the Java SE deprecation mechanism. He has previously worked on JavaFX and Java ME at Sun Microsystems. He has over twenty years of software platform product development experience in the areas of window systems, interactive graphics, and mobile and embedded systems. Stuart holds a Master's degree in Computer Science and a Bachelor's degree in Electrical Engineering from Stanford University.

Why it's here

2 people recommend this

What people say. Recommended as an interesting Devoxx talk on Java API design and best practices.

u/Jezzadabomb338in r/programming • Recommends

On “Your next JVM: Panama, Valhalla, Metropolis by John Rose”

Also, for those wondering, Devoxx finished a couple of days ago, and most of the videos are up on their Youtube channel. --- Some of the videos I found interesting: Optional by Stuart Marks Collections Refueled by Stuart Marks The Invocation Game by John Rose and Paul Sandoz Migrating to Java 9 Modules by Paul Bakker

u/Mentioned_Videosin r/programming • Recommends

On “Your next JVM: Panama, Valhalla, Metropolis by John Rose”

Other videos in this thread: Watch Playlist ▶ VIDEO|COMMENT -|- (1) Optional by Stuart Marks (2) Collections Refueled by Stuart Marks (3) The Invocation Game by John Rose and Paul Sandoz (4) Migrating to Java 9 Modules by Paul Bakker|+10 - Also, for those wondering, Devoxx finished a couple of days ago, and most of the videos are up on their Youtube channel. Some of the videos I found interesting: Optional by Stuart Marks Collections Refueled by Stuart Marks The Invocation Game b... (1) Greg Young - The art of destroying software (2) Jenn Schiffer, Engineer/Artist - XOXO Festival (2016)|+2 - Here's a sneak peek of /r/ConTalks using the top posts of all time! #1: The a…