Preventing Null Pointer Exceptions at Compile Time
Offered By: Devoxx via YouTube
Course Description
Overview
Explore a powerful type system that prevents null pointer exceptions at compile time in this 52-minute Devoxx conference talk. Delve into the causes of null pointer exceptions, including their relationship to object initialization, map keys, method contracts, Java 8's Optional class, and dynamic checks. Learn how to automate programmers' informal reasoning into formal proofs, surpassing the ease of use of Java generics or the Optional class. Discover pluggable type-checking and the freely-available Nullness Checker tool that integrates with development environments. Understand how this approach has uncovered hundreds of bugs in millions of lines of well-tested code and is accessible even to novice programmers. Gain insights into Java's type system weaknesses, specification techniques for non-null and nullable parameters, and the benefits of enhanced type systems. Compare various nullness tools, explore Java 8's extended annotation syntax, and learn about backward compatibility for Java 6 and 7. Examine practical examples, including lazy initialization, persistence across side effects, map key handling, and optional checks. Acquire tips for effective pluggable type-checking implementation and understand its role in improving code quality and reducing software failure costs.
Syllabus
Intro
Java's type system is too weak
Specification 1: non-null parameter
Specification 2: nullable parameter
Solution: Pluggable Type Checking
Optional Type Checking
The Checker Framework
Benefits of type systems
Comparison: other nullness tools
Java 8 extends annotation syntax
Java 6 & 7 compatibility (or avoid dependency on Checker Framework)
Lazy initialization and persistence across side effects
Map key example
Optional checks
Cost of software failures
Example: Regex Checker
Example type systems
Tips for pluggable type-checking
Pluggable type-checking improves code
Taught by
Devoxx
Related Courses
Algorithms, Part IPrinceton University via Coursera Introduction à la programmation orientée objet (en Java)
École Polytechnique Fédérale de Lausanne via Coursera MongoDB for Java Developers
MongoDB University Initiation à la programmation (en Java)
École Polytechnique Fédérale de Lausanne via Coursera Intro to Java Programming
San Jose State University via Udacity