In our Rails application, we are adding notifications. Some of these are blocking
: They stop the progress of whatever resource they are added on, because some information on that resource is missing.
Other notifications are simple notifications, and only provide information.
Today I had a discussion with another programmer on our team. I have created the inheritance structure like this:
He however, would rather like me to just add blocking
as a boolean-returning method on each Notification, and specify a list of subclasses that are blocking inside the Notification parent class.
The difference between these approaches is not very large; in my approach one does not have to specify this list, keeping the root class cleaner. On the other hand, the special logic that happens in Notification::Blocking
right now is not very large either.
What kind of abstraction is more suited for this problem?