related : https://refactoring.guru/introduce-null-object
The question is : when should we go for NilObject classes : from the first method to unify the way to handle this kind of things in the code base or wait until you have something a bit complex to do it ?
So let's say we have a Cup model that has tray_uuid and barcode attributes. In one case we want to get a Cup that is linked to a specific barcode and return the uuid of the tray it's stored on.