1. 8

First of a 7-part series on refactoring an actual real-world codebase.


  2. 7

    Sometimes, it’s fine. Field-level nulls (where it should be well understood what can be null and why) are examples where null may be perfectly acceptable.

    I never understand this advice and IDEA complains if you have field-level Optionals. Every blog post I’ve read saying you should avoid Optional field’s basically comes down to “put a comment next to the field to say it can be null”. But…why not just use an Optional and let the type system take care of that for me??

    1. 2

      There is some pragmatic and useful advice in here about different options (sorry!) for replacing null, based on discovering what the null means.

      Trisha’s article reminds me of the Void safety features in Eiffel. I don’t know whether this was the first context in which optional-value-as-type-annotation became a language feature, it’s the first I came across.