DEV Community

Discussion on: Null Object Pattern

Collapse
 
igorlord profile image
Igor Lubashev

The example is flawed. As presented, this is just one big hack. Why is the default value 50? Is it a mistake to call this without a valid argument (one that has the expected function)? If it is a mistake, do not paper over it by returning 50. If it is an expected condition, NullMovable is a horrible name, since it does not describe what concept/abstraction it implements. (Null abstraction is such that it is an error to perform any operation on it.)

Collapse
 
avraammavridis profile image
Avraam Mavridis • Edited

Agree, changed to DefaultMovable . Thx for the feedback