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 trialMichael Harrison
30,900 PointsWhy not enums?
I'm not sure why constant integers are used for the artist and role IDs, instead of just defining enums such as artistId { StanLee, SteveDitko }, etc. Is it the small number of entries in this test data? The default zero-indexing? Reducing the number of concepts addressed? Something else?
1 Answer
Steven Parker
231,210 PointsConstants are typically used to represent specific values, and enums where unique identifiers are needed but the values are not important.
Certainly enums could be used in this situation, perhaps constants were used because they are simpler and less likely to distract from the points of the lesson.