• 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
  • Paul Clapham
  • Ron McLeod
  • Bear Bibeault
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Jj Roberts
  • Tim Holloway
  • Piet Souris
Bartenders:
  • Himai Minh
  • Carey Brown
  • 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
 
Bartender
Posts: 7428
66
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: 15983
265
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: 15983
265
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: 15983
265
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.
 
I knew I would regret that burrito. But this tiny ad has never caused regrets:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic