I have a model “news item” which contains text, image etc to display as latest news on several pages in a website.
This “news item” can also be posted to Twitter or Facebook. Is it clean to implement a method post inside the news item model and inject the different post implementations as a strategy?
Or is it better to have a separate application service for this?
Thanks
It doesn’t belong in the model; an application service is more appropriate.
Create an interface,
IPostService, say, with a methodPostItem. Then create separate concrete implementations for Twitter and Facebook that implementIPostService.