I'm rather fresh in programming and I try to make simple app. App will allow user to make a character sheet for popular RPG game. Right now I trying to model it (on paper) and have (maybe a stupid one) question.
Each character have set of skills - a lot (33). And each skill cane have value of 0-5. Now my question is: is it better to make 33 ints insied Character object or make Class Skill and make array of Skills in Character? My knowledge of Java is not good enough to decide :( If anyone find some useful article about it or can just simply explain it to me I would be grateful.
I just hope it is not completely stupid question :) Have a nice day!
If you have a fixed number of skills you can use multiple attributes, will increase readability when used, but will make your class a bit ugly and less mantainable.
If values are always an int
, I would reccomend to use a Map
instead of array
or Collection
.
Map<String, Integer> skills;
So you can have a class with nice declaration and refer to skills by name and not by position in the array:
Integer strenghtLevel = skills.get("strenght");