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 trialWill Matthews
8,127 PointsWhy define the CurrentWeather extension in the CurrentWeather file?
I'm curious about why we'd want to define the CurrentWeather extension in the CurrentWeather file itself. Given that the keys we're defining are likely unique to the API we're using, why wouldn't we define this extension in the DarkSkyAPIClient file instead?
3 Answers
Jeff McDivitt
23,970 PointsDid you attempt to do that to see what happens?
Jeff McDivitt
23,970 PointsIf there are no issues it would really just be program preferance.
Claire Worrmald
6,442 PointsI believe it is due to preference and clarity of code, remember that the extension is used to conform to the CustomStringConvertible so he abstracted it out in to extension to reflect that he is going to use the description property. Just easy to read :)
Will Matthews
8,127 PointsWill Matthews
8,127 PointsI did. I can't seem to spot an problems in doing so just yet. Unless they're subtle?