I am new to developing OO systems. I have a simple application for flash cards in which I had problems finding the right way to archive the system. The application has a simple graphical interface with buttons for questions, answers and buttons. The question and answer data set is stored in the Derby embedded database.
Quick setup:
Database class - processes the connection, disconnects and returns an ArrayList based on the selected filter (currently called by the CardSet) (the DB class is configured as static)
The CardSet class. Uses the used ArrayList, holds the current Map. Map
class - contains data for a flash card (question and answer, a couple of other things)
Application class - creates a graphical interface and processes action events
So here is my question: I want to separate the GUI and application logic. I think this may be a good example for MVC, but I'm not sure how to really separate it all out (never used it). Does the controller create a class basically, which then launches the graphical interface and then creates other classes (in my case, CardSet). How about access? Should some things be static?
Another question. To handle GUI events, did you just configure it to call a common method in the controller class? For example, the "Next card" button is clicked if it just calls something like controller.nextCardAction ()? Should I try to use the Observer pattern so the GUI can retrieve data?
, Java-. . . Head First Design Patterns, , .