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 Remaining Tries

Anas Rida
Anas Rida
8,183 Points

where to write each piece of code

this may seem like a dumb question. I'm finding it confusing to understand how each method is distributed among the different classes. I don't understand why I need a Hangman class at all. Why couldn't this be done in the Game and Prompter classes.

1 Answer

Simon Coates
Simon Coates
28,694 Points

You could often do the work of another class inside it's calling class. Object oriented design is about breaking down the program into small units that can be debugged independently, swapped out etc. With simple programs, you don't see much benefit, but when the program is more complicated, there are a lot of benefits to modularity. Having a class (and thus object) that does too much risks being a "god object" .