I decided to figure out how to work using the MVP template and now I found such an article in Habré.
The bottom line is that presnter , as control levers, 2 interfaces are transmitted one per view (View) and the other per module (DB).
When creating a view , an object is created presnter -a and these 2 links to the interfaces View and Module transferred to it ...
In the article that I pointed out at the link above, this is the code for the class presnter
public class presenter { IView view; IDataBase dataBase; int Id; public presenter(IView view, IDataBase dataBase) { this.view = view; this.dataBase = dataDase; id = view.getId(); string name = dataBase.loadFromDB(id); view.setName(name); } public onSave() { string name = view.getName(); dataBase.saveToDB(id, name); } } So the question is:
I understand that View when created, implements the IView interface, creates an instance of the presenter and passes it a link to the already implemented IView interface, but where IDataBase View take a link to the IDataBase interface that also needs to be passed when creating the presenter ?
dataBase = new DatabaseImpl();The author of this article is rather doubtful. He even names classes with a small letter, which is not prohibited, but is considered bad form - miha_dev