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
Michael WilliamsCourses Plus Student 8,059 Points
Why have local values at all?
I understand the concept, and while it's not duplicating code it does seem like we're adding unnecessary code and making things more verbose?
IF I’m reading your question properly, they reason for it is simply readability. When using external frameworks, one of the most frustrating things to deal with is bad naming conventions, as it makes it hard to understand what’s going on when calling a function. By adding a local name to a variable, it makes it easier for the person writing/editing the function to see what they are working with, but allowing the external name to give more context to the variable that the function caller needs to pass in. This makes sharing code and working with external frameworks/libraries much nicer, even if it adds an extra word or two to the function definition.
First, makes no sense calling the function and specify the label, instead of writing the arguments by the order in the function constructor... and then I need to have an external and internal label, not to mention the crazy convention with the prepositions. For god sake... Hope you have an English grammar class in the Library... This is so much Apple.... This is just confusing for developers... to much to write just to assign an argument in a function.