Here is my solution, based on use-cases and AOP.
- you need to separate persistence from your domain
- you need to have a proper use-case, not a single request-class, like above.
- notifications are notifications (twitter, fb), they are implemented with AOP
- spam detection and language detection are separated (discussable) with an aspect.
- there is an "app" object that wraps it all together.
The first file is the original example. The second file is mine.
Flame :on
Exception is good imho. We could use another aspect to do something with this exception. Intercept it so it is not posted to airbrake.io, save in db so that admin can mark it as not-spam in SpamDetectionFeature.