SCJP 6.0 | Free Java Beginner Video Course | Twitter: @MarcusBiel
I noticed you are using a lot of static methods. Try to avoid that, if not completly remove that.
You copy & pasted System.out.println() a lot of times. Instead, you could also just do one output, with a "\n" for a new line. (Have this static text as a private static final constant, that you can then printout).
It seems to me, you have not yet the "hang of object oriented programming". Your code really looks a lot like C/C++ procedural code.
Your menuChoice method is really horrible, sorry, it has so many different levels that it would be too time consuming for me to understand what it is trying to achieve. This is a big welcome for bugs to hide.
Simply the code, if not possible at all, use more sub methods, with 1-3 lines per private sub method, using a speaking name. Try to make the code speak to you, like a book.
Also try to avoid a switch. I am not sure if I understood you correctly, but it seems you have 4 choices, that will start different options.
Why not implement this in an object oriented someway like this (still to be improved, I am just thinking loud...)
(not necessarily correct, more like pseudo code):
Alternatively, if things grow further, you could separate this into an input and output Channel, I mean having to separates Objects.
Then encapsulate your reading and writing logic into this / these objects. I know you will need some boilerplate code, just try to hide this nasty stuff as good as you can!
Also, I bet there is also some open source library / jar available somewhere that does exactly this
SCJP 6.0 | Free Java Beginner Video Course | Twitter: @MarcusBiel
Marcus Denker wrote:Hi Kendall,
please keep me updated with your progress on the matter, as I am highly interested how you would incorporate my feedback into your code![]()
Thanks,
Marcus
SCJP 6.0 | Free Java Beginner Video Course | Twitter: @MarcusBiel
How about having the enum in its own file, and adding the Strings to the enum values?
I feel they would belong together.
that would better be private static final, hm?
What do you need The interface Menu for?
Don't always create a reference.
Consider (just consider the possibility) Same here:
Consider using longer variables. I don't understand "TwoTeam"
for default switch case.
shorten boolean expression:
consider removing "get" infront of getters. This is old java bean style which will easily lead you to program an "anemic domain model" (Martin Fowler)
Never leave auto code or auto comments in your code, that looks very unprofessional:
ALWAYS use the curly brackets!