Hey fellow CP'ians,
thinking about my SW Architecture again i just came to the question if decoupling both ways by interfaces makes sense for the sake of decoupling.
Here is the spoken idea:
I create a controler for the UI so that the controler can do all the business stuff and the UI stays mostly dumb. I have a reference on the controler in the UI to access it's public functions. The controler implements the controlerspecific interface.
The controler on the other hand has a reference to the ui via the interface. With this i guarantee that the functions called by the controler are "implemented" in any UI that implements the interface.
Long story in code
public class UcProjectProperties : IProjectPropertiesView
{
ProjectPropertiesControler _projPropContr = new ProjectPropertiesControler(this);
public void UpdateUi()
{
}
private void ProcessUserInput()
{
_projPropContr.GenerateUpdateData();
}
}
The Interface of the Uc
public interface IProjectPropertiesView
{
void UpdateUi();
}
The controler
public class ProjectPropertiesControler : IProjectPropertiesControler
{
IProjectPropertiesView _view;
public void ProjectPropertiesControler(IProjectPropertiesView InView)
{
_view = InView;
}
public void GenerateUpdateData()
{
_view.UpdateUi();
}
}
The Interface of the Controler
public interface IProjectPropertiesView
{
void GenerateUpdateData();
}
I thought it to be a good idea because now i can unit test very easily but i am afraid it is a bit over the top?
You guys think that's a correct way or should i reduce to only one interface?
Thanks in advance
What I have tried:
Code written above and explained :)