Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Java Java Objects (Retired) Creating the MVP Prompting for Guesses

Naming conventions

I am having trouble keeping everything straight because of the way things are named. As it stands right now, I can't remember what any of these things do because they are all named the same thing. For example:

public class Prompter { 
  private Game mGame;

  public Prompter(Game game) {
    mGame = game; 

The word GAME is incorporated into the code six different times. Now it's all muddled and I have no idea what the code means anymore. Is the naming of things always like this or is it just to keep things simple for the course? My thinking is that it makes it more complicated until one gets to a point where the different classes and methods and variables make sense naturally.

1 Answer

Yeeka Yau
Yeeka Yau
7,410 Points

It definitely can be confusing, especially at the beginning. Just remember that the convention is that your object type starts with a capital letter, and an instance of that object uses the camel case notation.

For example in your Prompter constructor, you are passing in an object of type Game, and the instance of the object is called game (this can be confusing, and you can call the instance something else). For example, you could write it as:

public Prompter(Game hangmanGame){
mGame = hangmanGame;

Hope that helps.