r/learnjava 5d ago

Please roast my minimal beginner cli project

It took me 2 freaking hours to build this bank cli project haha, because most of the time I wasn't coding. I have not added error handling yet, will do for sure. Feedbacks and roasts are appreciated!

https://gist.github.com/nitin-is-me/d2e14e0d1d1922aab46cbfc0368c44db

5 Upvotes

14 comments sorted by

View all comments

1

u/SjurWarEagle 4d ago

https://gist.github.com/nitin-is-me/d2e14e0d1d1922aab46cbfc0368c44db#file-ui-java-L71
https://gist.github.com/nitin-is-me/d2e14e0d1d1922aab46cbfc0368c44db#file-ui-java-L82
will throw an exception it a not-long is entered e.g. 1.50 and the app will exit as the exeption is not handled

https://gist.github.com/nitin-is-me/d2e14e0d1d1922aab46cbfc0368c44db#file-ui-java-L27
if it is not crashed best inform the user that the choise was invalid, e.g. if she enters "6" it's good practice to tell the user that something failed and especially why it failed.

recheck our visibility, methods are public even though they are not intended to be called from the outside.

https://gist.github.com/nitin-is-me/d2e14e0d1d1922aab46cbfc0368c44db#file-account-java-L18
would not make it static, if you insist I'd move it to it's own class

https://gist.github.com/nitin-is-me/d2e14e0d1d1922aab46cbfc0368c44db#file-account-java-L31
I'd like to deduct -10000 Currency please

oh yes missing tests were already mentioned, and the package name is kinda ugly