Within the framework of the mvc-model, there is an idea consisting of several forms (login and password entry form, main form, several forms displayed before the main one - there are some settings, section "about the program", etc.). So, there are several questions:

  1. Should I split the controller into several (one for each submission) or make one large, containing links to all submissions?
  2. Do I need a kernel that will provide a transition from one view to another or specify such methods in the controller?
  3. If necessary, what functions will the kernel provide, except for how to change the visible? (after all, why disconnect the observers from the form, if it is already invisible)
  4. actionPerformed (ActionEvent event) is better to do in the view and call from it the controller methods or in the controller itself?
  5. How in actionPerformed (ActionEvent event) to find out from which view the event came, from which object and which event (pointing the mouse, taking in focus, left-clicking, right-clicking or something else)?
  • @ Andrey759, check the language. I understand that this is java in the context of android applications? > Should I split the controller into several? Yes, the thinner the controller, the better. - etki
  • Java Swing (I know that swing is disgusting, but I couldn't watch it) - Andrey759

1 answer 1

  1. MVC, it’s MVC to make life easier for a programmer, you can create one controller that will handle everything, but you have to go to the kitchen, sleep in the bedroom, wash yourself in the bathroom. I think the logic is clear.
  2. Again, a simple example, you live in a house (eat, sleep), and work in an office (sit, walk, type).

MVC before everything is created for ease of development, if you use this system, then use as expected.

  • For quite a long time I pondered how to link the recommendations (1 and 2) of the answer with the specific items 1, 2, 3, 4 and 5 in the question. In addition to the trivial (although somewhat controversial) advice, do as you prefer, but only within the framework of the MVC concept, nothing sensible has come to mind. - avp
  • @avp, if you think only directly, then in my post I point out that everything must have its place. Each controller should perform a specific task, and not collect everything in itself. - avengerweb
  • Thank you for answering the first question. In this context, the answer to the second question becomes obvious. Regarding the third question - this is probably not a question, I just wanted to hear more information on this topic from knowledgeable people. The fourth and fifth questions remain unanswered (within the framework of, for example, Java Swing, although not only). - Andrey759
  • For example, I saw such an implementation of the observer model: JButton button1; button1.addActionListener (this); public actionPerformed (ActionEvent event) {if (event.getSource () == button1) ... and then calling some method from the controller. } I will not be able to make such a comparison outside the presentation class, since button1 is private, and sending a link to it to the controller seems like a wild perversion to me. But most importantly - how to do it right? - Andrey759