Stefano, it's kinda wierd how you wrote this letter... because you (correctly) know that I've been so... ahem... touchy on this issue ;-)
I know, I know. I also know your code-ownership-ness has being reducing since then steadily and constantly, but we are never far enough from our egos to be safe, remember? :)
Well, the fact is that they were written by me some years ago, after lot of thinking, but with an eye to a certain "perfect" notification system, rather than to solve the simple problem. Then the later modifications made them better but kept the same goal.
Now this is clear, because *no* feature that the system makes available has ever been used. Everyone, please witness this: if you do more than is necessary beforehand, most probably it will be *never* used.
This is why I'm so *touchy* (aka PITA, aka bastard from hell) at adding stuff to the sitemap and to the FOM: add one little thing at a time and see how the environment changes.
This is how biological evolution moves and I think it did a pretty darn good job :)
Before replying, I have looked at the code, and it's not that "complex" or overengineered to me, but that's probably because you have a different view of what it should do... anyway, a couple of things can be done easily, like switching to a full concrete implementation instead of using interfaces.
Yes. Abuse of interfaces is the first sign of YAGNI (hey, I like this acronym, thanks Sylvain for pointing it out! :)
Notifying.java -> zap, never used
great, that alone makes my day
NotifyingCascadingRuntimeException.java -> zap, never used
even better.
NotifyingBuilder.java -> zap, never used
see? it's not that hard to make me happy after all :)
SimpleNotifyingBean.java -> Notification DefaultNotifyingBuilder.java -> NotificationBuilder Notifier.java
So the result would be:
Notification (what to notify) NotificationBuilder (the Notification creator) Notifier (the Notification "sender")
Which is much simpler, and loses all extensibility, which has never been used.
now we are talking!
We could also merge Notification with NotificationBuilder and have simply
Notification Notifier
but then we could also have simply a
Notification
that can both create itself and send itself, but I'd prefer the three class version.
Anyway, this is waht I came up to now. Dunno if it makes sense, maybe it solves the wrong problem, what do you think?
+1 for the three classes version. It separates concerns cleanly without aiming for too much abstraction.
Now, are you also volunteering to do the fixes? it would sure take you much less effort than me since you know the code better.
TIA
Stefano.