I was wondering if the null object pattern could actually make debugging more difficult in certain cases. For example, if a method returns an "empty" object rather than a null then it will not throw an error. This is good in terms of reliable, clean code but couldn't it mean that there is now an empty object being used that essentially does nothing that could cause unexpected bugs. Rather than having a null exception to point the programmer to the problem there is now nothing to help locate it.
Aucun commentaire:
Enregistrer un commentaire