I haven't actually written this yet, I'm just making some plans. This will
be my second or third "real" project in Java (I don't count tutorials,
experiments, etc.)
Where I get confused is where to put the intelligence, where to put the
drawing algorithms.
CCheckersStyleGameBoard inherits CGameBoardStyle
CChessGame inherits CGameManager
CChessPiece inherits CPiece
(Same thing for COthelloStyleGameBoard, CPenteGame, CPentePiece.)
Obviously the GameManager is going to create the CGameBoardStyle and give it
parameters, Black And White Squares 8 by 8. It is going to create the
CChessPiece objects and "place" them on the board somehow.
The CGameBoardStyle derived class is going to draw itself, and based on
coordinated determine the size and location of the pieces to be placed on
the board. Abstract function CPiece.Draw will be called for each piece,
with size and location information passed from the calling CGameBoardStyle
class. (I feel semi confident about this.)
Now I read that Java doesn't support multiple inheritance. Does this mean a
class cannot be derived from both JPanel and CGameBoardStyle? Or is this
where the "implements" keyword comes into place. (If so it would seem Java
~does~ support some form of multiple inheritance, but only one class can
contain functions which are not purely virtual.)
Well that is my plan - any advice is welcome :)
--
LTP
:)
Benji - 27 Oct 2005 06:08 GMT
> <snip>
I'm going to save Roedy from having to say this (although he won't see my
post since he's got me killfiled... =P), but...OMG, don't put a C in front
of every single class definition. It's not useful at all.
See http://mindprod.com/jgloss/unmainnaming.html
basically, in java, anything that is capitalized is a class - so the C
is just obfuscation.

Signature
Of making better designs there is no end,
and much refactoring wearies the body.
Roedy Green - 27 Oct 2005 07:23 GMT
On Wed, 26 Oct 2005 22:49:56 -0600, "Luc The Perverse"
<sll_noSpamlicious_z_XXX_m@cc.usu.edu> wrote, quoted or indirectly
quoted someone who said :
>Now I read that Java doesn't support multiple inheritance. Does this mean a
>class cannot be derived from both JPanel and CGameBoardStyle? Or is this
>where the "implements" keyword comes into place. (If so it would seem Java
>~does~ support some form of multiple inheritance, but only one class can
>contain functions which are not purely virtual.)
see http://mindprod.com/jgloss/multipleinheritance.html
Just make sure you don't muddle in one class the code to draw a pawn
to do logic about pawn move abilities etc.
Make sure you understand the Model/View/Controller design pattern
before you launch into this project. It will be a very good thing if
you can nicely separate your design logic.
http://mindprod.com/jgloss/designpatterns.html

Signature
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.