Re:The Second Edition of “Refactoring”
by paulddraper on Sunday December 02, 2018 @05:54PM
(#18585096)
In languages without "everything can be null", the null-object pattern is what is always done.
The problem with "everything can be null" is the type system is prevented from finding very common "you can't do this thing" errors.
Without it, everyone uses null objects (or Maybe, a generic for of this) and there are no segmentation faults/dereferencing errors. (Yes there can be other sorts of errors, but the problem has been made far better.)
Re:The Second Edition of “Refactoring”
by goto11 on Sunday December 02, 2018 @06:18PM
(#18585211)
The "Null object pattern" is a particular pattern where missing values are represented with an object with "neutral" behavior. This is not the same as an actual null or an option type.
The problem with "everything can be null" is the type system is prevented from finding very common "you can't do this thing" errors.
Without it, everyone uses null objects (or Maybe, a generic for of this) and there are no segmentation faults/dereferencing errors. (Yes there can be other sorts of errors, but the problem has been made far better.)