Hi all, I'm a relatively inexperienced Java programmer and am in the middle of building a Cribbage game written in Java. This is probably a bit ambitious for my skill level, but it's been fun so far and a great learning experience.
However, I'm running into a few roadblocks and want to make sure that I'm building this thing "correctly" from a design perspective, before I get too much farther. Anyway, my situation is this:
In my GUI class, I've got an actionPerformed method to handle events such as the user clicking on buttons, etc. I've also created a "gameFlow" class which is meant to handle the flow of the game - from dealing the cards to discarding, scoring, pegging, etc, etc. (I also have other classes as well such as a Card class, Deck class, etc.)
Anyway, my gameFlow class has a big loop that will keep repeating the necessary phases of the game until someone wins, as determined by checking their score at the conclusion of the loop. However, since my event handling is done back in the GUI class, there seems to be a real dissociation between the gameFlow and the event handling. I'm starting to wonder if my gameFlow logic should really be put inside the GUI class, where its methods can be directly called by the events that trigger the actionPerformed method.
Can anyone suggest any ideas, or even reassure me that the way I'm doing it so far is correct? I realize my question is a bit vague, but I didn't want to just post a bunch of code and hope people could figure out what the heck I was getting at. Again, my main concern is not with the complexity of the code - I think I'm handling that just fine. It's the design and structure of my program and how the various objects interact with each other, and pass control around the program that stumps me sometimes. Any suggestions are greatly appreciated!!