You should always check the data being returned.

Null objects allows you to be more expressive. I see my example of returning an Invalid author when none is found is not really a good example. In production code we’d normally return an “Author.Unknown” type instead.

And obviously you should have tests that’d catch these logical errors.

MSc. | Writer with +1M views. | Lead Developer and Manager in Big4, ex. FinTech. Sharing my opinion & what I learn. New YouTube Channel https://bit.ly/3vxqNHj

MSc. | Writer with +1M views. | Lead Developer and Manager in Big4, ex. FinTech. Sharing my opinion & what I learn. New YouTube Channel https://bit.ly/3vxqNHj