I'm creating notifier/notifee relationship. I'm not quite sure which is better in design though. As for "better", my goal is to get something that is extension friendly. As an example, see below:

alien_enthusiast.notify( UFO_Sighting( London, 1500 ) )


alien_enthusiast.notify_ufo_sighting( London, 1500 )

Which is better in terms of extension? If there's a better alternative, that would be great to know.

4 Answers 4


I prefer

  • simple verbs at the expense of complex nouns


  • simple nouns at the expense of complex verbs

so equating verbs with methods, and nouns with their parameters, then I'd pick the first of your choices.

Actions (verbs) are harder to reason over as they are already connecting things (nouns), and engaged in behaviors, so I find that additional complexity there tends to compound.

This is a principle behind CRUD, where the verbs are simple and the nouns potentially complex.

I think your users (of extensibility) will prefer only having to implement one listener instead of many individual ones.


Of your two examples the first is better simply because the second would require you to alter the alien_enthusiast every time a new type of sighting is added.

As in

alien_enthusiast.notify_weather_balloon_sighting( London, 1500 )

But the first isn't good either, as the sighting is locked down to be an UFO sighting.

I would suggest

sighting = Sighting( UFO, London, 1500 )
alien_enthusiast.notify( sighting )

when it as always later turns out it was a weather balloon you can do

sighting.updateCategory( WeatherBalloon )

Your enthusiast will disappointed, but can turn around in his car and safe some petrol.


I agree with Erik in this case because I suspect you're working in an Object Oriented Programing paradigm. OOP loves to add nouns. It's not so good at adding verbs. That's the main reason nouns have more complex names than verbs.

In a functional environment you can add verbs easily. It's nouns that are hard to add. So here you tend to have fancier names for verbs.


If it can notify Sightings then Sightings can be a nice candidate for an interface/base class. So it becomes more future proof to do notify(Sighting implementation). UFOSighting implements Sighting and maybe in future you have AlienSighting.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.