At the place I work we are using a SafeReader class that wraps an IDataReader. One of the 'features' is that if the field you are trying to access wasn't in the query then it just returns a default value.So I am working with some code that is already in place, but apparently never fully worked as it accesses fields that aren't returned from the stored proc it's calling but it didn't throw any exceptions since the SafeReader kindly returned default values.I personally don't like this because it means that when there are mistakes in the code (someone forgets to include a field in the query, or perhaps a misspelling) then it's harder to catch.My question is whether this violates any general 'best practices' of development or object oriented programming ideals? Or does this seem perfectly reasonable?
Is it a good idea to return a default value if a field in a query cannot be found?
c#;object oriented;object oriented design