I recently saw a MVC java application in which the main method was written as:
public static void main(String[] args)
{
SwingUtilities.invokeLater(new Runnable()
{
public void run()
{
View view = new View();
Model model = new Model();
Controller controller = new Controller(view, model);
controller.start();
}
});
}
Wouldn't this make all the program (including both the model and the controller, that have nothing to do with Swing at all) run until the code ends in the AWT Event Dispatch Thread instead of the Main thread?
If this last was true, then that would be really bad for the app as it would block the EDT from carrying out the tasks it needs to (dispatching events, for example, as the model could be calculating other tasks). Is it correct?
There is a similar old post (not a duplicate from this one) that can suggest the code mentioned above is good practice, so it confused me even more.