NewsService and NewsViewPresenter coupling

Mar 26, 2008 at 6:38 AM
Right now, NewsService is responsible to lookup regions, view and metadata in order to see whether a news is already being shown or not.

If so, it returns immediatly. It not, if resolve the presenter and then it is the presenter's responsability to get the region, setup the view and metadata.

That is HIGHLY coupled.

I think the presenter's interface should contain something like:

public interface INewsViewPresenter
  IEnumerable<string> ShownSymbols { get; }
  void ShowSymbol(string symbol);

Furthermore, why INewsService exist anyways? Couldn't PositionSummaryPresenter deal directly with INewsViewPresenter?

Or is it because the sample is too simple and normally the service would contain lots of logic?

If such a service is justified, have you considered thinking in terms of flow (use cases) instead of services?

When IPositionSummaryView.NewsRequested, it launches the AddNewsFlow.Execute(symbol);
Mar 26, 2008 at 10:51 PM
Hi Francois,

Thank you for the feedback. You are absolutely right: this is highly coupled. The idea was not to tackle communication between modules in that iteration.
This is definetely going to be revisited when we discuss the different communication options we could use to solve these kind of issues.
In fact, there is a TO DO comment on the top of the NewsService class that says that the class will be removed after adding communication capabilities.
We are trying to avoid YAGNI as much as we can, but be sure this will be properly addressed.

On the other hand, there is also an issue in that "service" that is not related to communication, and it's regarding the responsability to know what other symbols were already shown. We are currently thinking that there should be a way to have named views, in order to not adding a view again if it was already added, without having to look into its inner implementation.

Julian Dominguez