by
Lessons:24Length:2.4 hours
  • Overview
  • Transcript

3.11 Introduce Null Object

The Null Object pattern is rather notorious for what it is meant to do. It’s used in jQuery when performing operations on DOM elements, for example. It’s possible to do the same with Ruby by instantiating special kinds of null objects in your code. That way, you don’t need to be constantly checking for `nil` every time to prevent errors.