Is a new Boolean field preferable to a null reference when a value may be missing significantly?

I do not see why, if you have a significantly absent value, no should not be used if you are deliberate and careful about it.

If your goal is to surround the nullable value to avoid accidental referencing, I suggest creating the isPasswordChanged value as a function or property that returns the result of a null control, for example:

Class Member {
DateTime lastChangePasswordTime = null;
bool isPasswordChanged () {return lastChangePasswordTime! = null; }


In my opinion, do it this way:

  • Gives a better readability of the code than a null check, which could lose context.
  • Removes the need for you to have to worry about maintaining the isPasswordChanged value that you mention.

The way you store the data (probably in a database) would be responsible for preserving NULL values.