Suppose I’ve written a class that does something useful.
This class, let’s call it a Widget, is created like this…
a = Widget.new(some_value)
Not all values of ‘some_value’ are valid and I need to indicate when
I see two ways to signify this…
a = Widget.new(invalid_value) #=> nil
a = Widget.new(invalid_value) #=> raises an exception
Which of these do you prefer and why?
Would you prefer both? How about a ‘Widget.new!’ method that throws an