Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.
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.