Is using MultiMaps code smell? If so what alternative data structures fit my needs?
Posted
by
Pureferret
on Programmers
See other posts from Programmers
or by Pureferret
Published on 2014-06-26T21:43:49Z
Indexed on
2014/08/22
4:27 UTC
Read the original article
Hit count: 452
data-structures
|code-smell
I'm trying to model nWoD characters for a roleplaying game in a character builder program. The crux is I want to support saving too and loading from yaml documents.
One aspect of the character's is their set of skills. Skills are split between exactly three 'types': Mental, Physical, and Social. Each type has a list of skills under if. My Yaml looks like this:
PHYSICAL:
Athletics: 0
Brawl: 3
MENTAL:
Academics: 2
Computers
My initial thought was to use a Multimap of some sort, and have the skill type as an Enum, and key to my map. Each Skill is an element in the collection that backs the multimap.
However, I've been struggling to get the yaml to work. On explaining this to a colleague outside of work they said this was probably a sign of code smell, and he's never seen it used 'well'.
Are multiMaps really code smell? If so what alternate data structures would suit my goals?
© Programmers or respective owner