MVC Question

Hi

In order to become more efficient at making an OOP design, I am starting off by thinking up simple ideas for programs and then trying my best to design them in an efficient, OOP fashion.

So here's the scoop. I'm making a TicTacToe program, which allows someone to play a computer. It is not server-based; it's simple. I am following the MVC (model-view-controller) design for handling the communication between my objects.

My controllers are MainWindow (JFrame object , specifically the MenuBar of my GUI, which starts and stops games, etc.), my HumanPlayer, and my ComputerPlayer. My model is my TicTacToe object, which knows the game, and my views are a StatsPanel object (shows move history and wins/losses) and a Board object (view for the actual 3x3 board).

Here's the question: My HumanPlayer and ComputerPlayer need to keep track of whose turn it is. I make these two classes extend a Player base class, which has a protected static variable called turn and protected static finals called HUMAN and COMPUTER. Nice and dandy, but my Players are going to have to constantly be checking for whose turn it is. So I plan on making them into Threads, which in the run loop have an if statement nested inside a while loop (perhaps a while(true)), that checks to see whose turn it is. Hopefully, since they're Threads, this won't hurt the performance of the program.So, Is this efficient OOP? If not, why not, and how could I do it better?

[1486 byte] By [dynobirda] at [2007-10-2 2:42:56]
# 1

It is worth noting that MVC is a design pattern. You don't need OOP to use MVC. Again Thread can be used in C so they are not a feature of OOP.

Using Threads may improve interactivity, but Threads introduce overhead so less Threads generally mean less CPU consumption.

I cannot see any examples of OOP. OOP describes how an application is designed not how it performs or how easy it is to use. An efficient OOP design could mean it has no redundant classes/methods and is not overly complex.

IMHO, static methods do not follow OOP design as they specificly do not require an object to be called. They are very useful, but not OO.

Peter-Lawreya at 2007-7-15 20:35:35 > top of Java-index,Other Topics,Patterns & OO Design...