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 Getting Started

Diego Marrs
Diego Marrs
8,243 Points

Prompter and Game?

I'm stuck on what the purpose of the prompter and game file are and what they do.

Help is appreciated!

1 Answer

I guest that has something to do with Separation of concern. Mr.Craig said Separation of concern will make more sense after we complete our application.

Diego Marrs
Diego Marrs
8,243 Points

I'll try that out, thanks!

Anjali Pasupathy
Anjali Pasupathy
28,883 Points

The Prompter file prompts the user for input, and checks whether or not that input matches the answer provided by the Game object held in the Prompter object. The Game file holds the logic of the game - it decides what to do if the input from the user matches the Game object's answer, and what to do if that input doesn't match. Whether or not the input matches is information provided by the Prompter, which essentially serves as a go-between between the guesser and the game.

The separation of these parts of the game - the part that handles interaction between the game and the user, and the part that handles the user logic - is ideal because of Separation of Concerns. Because a Game object and a Prompter object do separate, specific things, it's easier to reuse those objects for other applications. If you wanted to create a different Game that requires a Prompter, you could reuse the Prompter object you created.