So I have a file to process that contains a command on each line. Currently it's implemented like this(this is a refactoring assignment):
The objects(4) inside the hashmap, each contain a different sendCommand method.
The thing is each of these method implementations are just 2 or 3 lines and this feels a bit wrong because those object don't store anything and they just have one method.
Should I instead make this a into a switch and instead process all the commands in one function?
Is there any other way to do this? Any design pattern meant to this? Any other reason the initial implementation is bad or good?