This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin Cookbook and have Ken Kousen on-line!
See this thread for details.
Win a copy of Kotlin Cookbook this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Knute Snortum
  • Henry Wong
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Frits Walraven
  • Joe Ess
  • salvin francis

My first small project with Java

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello!

I've just made my first small project with java, I've been learning java for 3 weeks now and i wanted to test myself with this project.
The project's concept is about trying to guess names given randomly by the computer and the more you guess the harder it becomes

any feedback is much appreciated. Thank you

https://github.com/Night9O/GuessTheName
 
Saloon Keeper
Posts: 6619
62
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Most members and visitors will not click on unknown links. Please cut and paste your code into a post and UseCodeTags (<-link).
 
Sheriff
Posts: 14622
243
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When you commit to source control, you'd normally commit the file name as is, not change it to something like GuessTheName_SourceCode. I expected to see GuessTheName.java instead since it's a Java program.
 
Junilu Lacar
Sheriff
Posts: 14622
243
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Good attention to formatting and indentation!

Many of the names don't follow the normal Java convention for capitalization though. Method names and variable names start with lowercase letters and camelcase for any other words so RandomNameGenerator should be randomNameGenerator instead, PlayerLevel should be playerLevel and so on.
 
Junilu Lacar
Sheriff
Posts: 14622
243
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Some methods are way too long and do way too much. The random name generator method and the probability method in particular are just monsters. Consider applying the Compose Method Refactoring to make the method shorter and to a single level of abstraction. Eliminate duplication as well.
 
Where all the women are strong, all the men are good looking and all the tiny ads are above average:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!