I am new to programming/Java and have been trying to teach myself it the last couple of weeks using some free textbooks and online resources. I thought a good way to learn would be to build a role-laying game I enjoy into a Java program. That being said, I know lots of people don't document their code effectively and want to avoid this being a habit, so I am trying to document everything in as much detail as possible. I cannot figure out if I am documenting this correctly though, even when referencing the Javadoc page, so any help would be appreciated. Basically I have a class 'Character' which implements all the required aspects of a character in this game. As an examplle, I have an enum which is a list of possible ability scores for a character in the game:
/**
* AbilityScores is an enum type containing all the possible ability scores in the game. It is
* utilized by the HashMap {@link #abilities} for the keys with an int being used as the values.
*/
private enum AbilityScores {
STRENGTH,
DEXTERITY,
CONSTITUTION,
INTELLIGENCE,
WISDOM,
CHARISMA,
INSPIRATION,
ARMOURCLASS
}
Then I have the corresponding HashMap:
/**
* abilities is a {@link HashMap} collection that contains {@link AbilityScores} as
* keys and {@link Integer} as values.
*/
private HashMap<AbilityScores, Integer> abilities = new HashMap<AbilityScores, Integer>();
And then here is an example of my accessor method for a character's strength:
/**
* This method returns a character's strength in the form of an integer.
* @return strength as an integer.
*/
public int getStrength() {
return abilities.get(AbilityScores.STRENGTH);
}
Am I documenting this correctly or have I incorrectly used '@link' etc. I did find some examples but I wasn't 100% sure as I couldn't find an example (apologies if there is one) where it showed an entire one start to finish like this one.
Any input or guidance is appreciated! Thank you