I am working on an open-source project and trying to refactor the current codebase. I am stuck in a place where I know the code is not well written, but I am not sure how to fix it.
I have Game.java
which expects user input through Scanner
with 10 different options to play the game. Options look something like this:
- Going to Battle
- Using First Aid
- Going to Town
- Go to Home .....e.t.c
I have already converted these options to enum and now switch case is for enum GameOptions
.
My Confusion is:
Some of these options have a
- nested switch case,
- some of these call other static methods from another class,
- some options call another method in
Game.java
itself.
I am not sure how to best refactor this code.
For reference to code: https://github.com/SaurabhKukreja/Text-Fighter/blob/master/src/com/hotmail/kalebmarc/textfighter/main/Game.java#L154
Aucun commentaire:
Enregistrer un commentaire