One of the benefits of this pattern is that you typically would avoid the need for a hasBoss method (unless there's an exceptional case where you would need that check). Otherwise, using null objects should remove the need to do that.
I would agree that an array of bosses would work well, if the scenario warrants it.
Thanks! Great feedback.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
One of the benefits of this pattern is that you typically would avoid the need for a
hasBoss
method (unless there's an exceptional case where you would need that check). Otherwise, using null objects should remove the need to do that.I would agree that an array of bosses would work well, if the scenario warrants it.
Thanks! Great feedback.