Wednesday, May 25, 2011


I have found a good document on MVC : Model-View-Controller Architecture
Some explanations :
  1. There is a class with a main method that will instantiate the model, the view and the controller.
  2. It is in the controller constructor that the model and the view are passed.
  3. In the view there are several buttons. Behind each button there is a different action. The action that is triggered by the button is not processed by the view ! But by the controller. It is the controller that will make the view aware that in the case that a button is pushed that it is the controller that will perform the action and this occurs in the constructor of the controller (in our example).
  4. In the controller, there is a method actionPerformed where all the magic will occur. The  actionPerformed is called and is passed an action. Depending on which action was passed (a String is linked to the action and decoded), the controller will execute a method of the model.
  5. This is imho not complete enough to understand everything on MVC.

No comments:

Post a Comment