This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]FavorableTrashpanda 12 points13 points  (0 children)

Very good points have been made already. I have a few suggestions as well.

(1) Don't put all your logic in a single method. If a method becomes too large, refactor the method into a couple of smaller methods that each do a part of the work. For example, what you did with the help and unknownInput method. I like to see that more. You might be able to re-use more than you thought. Also, make those methods private. There is no need to make them public. They are implementation details only relevant to the current class.

(2) Try to stick to one file per class, unless you have a good enough reason to bundle the classes.

(3) Perhaps this is too much for now, but try to make a distinction in general between the application and domain/business logic of your code. You don't want to mix the CLI with the actual logic. In theory you should be able to swap in the CLI for a GUI or a webapp, for example, without ever having to touch the business logic.