DEV Community

Discussion on: What is an analogy or visualization of a coding concept that really helped you understand it better?

jerielng profile image
Jeriel Ng • Edited on

One thing that really helped me understand optional unwrapping in iOS was the box analogy, particularly by using Schrödinger's cat. At runtime, you don't know what value an optional property will hold, whether it's nil or contains a value, until you actually call it. And you can either do it safely, by nil-checking it first, or implicitly unwrapping it and hoping it doesn't blow up in your face.