3 ms·
Yes, I agree. Naming a class with a verb is a good signal that you're trying abstract the wrong thing. If you want to move certain responsibilities outside the
by hcarvalhoalves 14y ago
Yes, I agree. Naming a class with a verb is a good signal that you're trying abstract the wrong thing. If you want to move certain responsibilities outside the object, you make a "Handler" class that is in charge of that behavior and listen to appropriate events.
How I would approached it: refactor the logic in FacebookHandler/TwitterHandler, make the Comment object send an event when one is added, make the handlers listen and do their magic. Implement a common interface for grabbing the Tweet/FB post text. Done. Now all your models can post to Twitter/FB with a common interface.
EDIT: For clarity