Pjotr Inno wrote:How would you rate my code?
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
Pjotr Inno wrote:It's pastebin, almost every coder uses it
Stephan van Hulst wrote:
Pjotr Inno wrote:It's pastebin, almost every coder uses it
I really don't think so.
Winston Gutkowski wrote:
Pjotr Inno wrote:How would you rate my code?
Well, it's nicely formatted, and you appear to be using proper Java naming conventions; so well done on that score.
However:
1. I'd suggest adding Javadoc headers for all your public methods.
2. This is a personal preference, but I'd use switch statements rather than those huge if...else blocks. These days you can use them for Strings as well as numeric values.
Either way, having lots of them suggests that you're doing a lot of "dispatching", so it might be worth considering subtyping/polymorphism, or possibly enums, to hide some of that logic, or make it more readable.
3. Your handleBanCommands() method looks very "monolithic", so I'd try to break it up a bit ... actually, a LOT.
My general rule of thumb is that methods should rarely be longer than a "viewable page", or about 20 lines of code - and 10 is even better.
HIH
Winston
Pjotr Inno wrote:It's pastebin, almost every coder uses it
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Pjotr Inno wrote:I'll definitely improve the handleBanCommands method, since it's massive
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
Pjotr Inno wrote:It's pastebin, almost every coder uses it
Tim Driven Development | Test until the fear goes away
Don't get me started about those stupid light bulbs. |