I have a basic swing application that I am trying to develop using MVC structure.
The principal class in the model connects to a derby database and retrieves values from columns and stores them in arrays.
My methods in the model (Connect(), Retrieve()) are public void. In runApp(), which is a SwingUtilities runnable, I am calling my model methods like this:
public static void runApp() {
Model model = new Model();
model.Connect(); //Connects to database
model.Retrieve(); //Retrieves database column values from tables, creates arrays
View view = new View(model);
Controller controller = new Controller(view, model);
view.setCalculateListener(controller);
}
I am trying to write this program so that everything is as less tightly coupled as possible. This code currently works as is, but I would like to do this better.
My question: How can I do this in a less coupled manner? Rather than having the methods being called here, is there a better way to do this?