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 trialkelake
4,223 PointsHard coding the data within a class
Is this video Pasan has said that it is not wise to tie your data to your model - to not hard code your data within a class. But isn't that exactly what we are doing? The Vending Selection is contained within the Enum and within an array in the class FoodVendingMachine. What am I missing?
1 Answer
Emin Grbo
13,092 PointsI think that was just the current state of the app you were working with. Later on he will explain the proper method and how to avoid hardcoding the data, but also, the think that confuses you a bit is that because this is just a practice example, you have to hardcode some stuff in just so you would see if it works.
Real life examples work a bit differently, but in tutorials we don't have access to some external database we can use, so we need to hardcode some stuff in :)
Next few tutorials will make it much clearer!
Hope i helped a bit. Don't forget to rate the anwer that helped you the most.
kelake
4,223 Pointskelake
4,223 PointsThank you Emin