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) Meet Objects Privacy and Methods

Randy Cole
PLUS
Randy Cole
Courses Plus Student 2,494 Points

Missing the point... What is actually happening in the application

Ok so I'm getting how the code works but my brain is stuck on trying to figure how this actually relates to the application for the user other than displaying the name of a pez dispenser and why are these methods being used rather than just using the printf method... I know this one of those DUH moments lol

1 Answer

Having just gotten into this a few months ago, Randy, I can tell you that these hypothetical cases are the norm, so for me, getting used to reading them was helpful. I think Craig is just getting beginners used to reading it. And it is helpful, because whether it's a simple string or a huge class, the basic concept is the same. It's not that the dispenser does anything, so much as how we organize it's existence. But when it does do something, like dispense, the model is already in the example, so I guess it is really helpful. Kinda like different design patterns. Here, check this out:

https://github.com/iluwatar/java-design-patterns

Randy Cole
Randy Cole
Courses Plus Student 2,494 Points

Ok that makes sense... I feel like in the back of my mind I understood that concept but for some reason my expectation was for this to directly result in the display of objects in an application, rather than as you so well put it the organization of those objects existence. Thanks keeping that explanation in mind should really help keep things clear going forward!