Search code examples
javaoopclass-diagramchess

Trying to convert diagram of a chess game to java code (abstract)


I am attempting to convert this diagram in to java code just to get a hang of design questions that can be asked.

For instance the Piecetype enum i would write as

public enum PieceType{
    pawn, king, queen, rook, bishop, knight
}

I was wondering if someone can provide guidance as to how to convert the class diagrams in to the java code just literally take one of the classes shown in the diagram and write the attributes and methods mentioned in java .

I am mostly having hard time figuring out the + and -.

enter image description here


Solution

  • + and - refer to visibility:

    Symbol  Visibility
    ------  ----------
    +       Public 
    -       Private 
    #       Protected 
    /       Derived (can be combined with one of the others)
    _       Static
    

    (source)