upbeat.it

by Cesare Rocchi

Nothing is Something

by Cesare Rocchi

Tags: ruby swift oop

Since I discovered /dev/null on Unix I have been always fascinated by the concept of nothingness in computers. When I started developing in Objc it took me a while to get acquainted with the fact that “it’s ok to send messages to nil”. And now Swift has changed the cards again with optionals. I recently watched this presentation by Sandi Metz at RailsConf 2015.

She has been a Smalltalk developer and in the video the influence of “programming as message passing” is very evident. Besides being a very entertaining speaker she goes over a few interesting examples of refactoring, all avoiding the check for nil, and favoring the Null Object Pattern.

I wasn’t a fan of optionals in Swift. I am gradually discovering how much time a simple ? can save you.