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 trialKARTIK BHASIN
9,299 PointsHow to figure out the namespace here?
What should be the correct answer to this quiz question. I thought that Illustrator should be the answer but it is not as it shows a bummer when I put any of the four choices among Adobe, Illustrator, Canvas, Paint in the blank space and submit answer.
2 Answers
Seth Reece
32,867 PointsHi Kartik,
In this case, Paint is the method, Canvas is the class, and Adobe.Illustrator is the namespace.
Enrique Munguía
14,311 PointsWhen you have an identifier built with several words you need to interpret them from right to left, lets say you have a method call
Foo.Bar.Baz.Boo()
The name with the parenthesis always is the method, and the method must be associated with a class. Both methods and classes names can contain only one word, so Boo is the method and Baz is the class, the rest must be the Namespace because Namespaces can be formed with several words separated by dots.
KARTIK BHASIN
9,299 PointsThanks a lot Enrique and Seth, the concept of naming namespaces became clear to me. Cheers!!
KARTIK BHASIN
9,299 PointsKARTIK BHASIN
9,299 PointsThanks for helping Seth, can u just help me in clarifying one thing, since Adobe is the name of an organisation so is it safe to assume that organisation name is included in the namespace name?. I mean here the namespace is Adobe.Illustrator and not Illustrator.
Seth Reece
32,867 PointsSeth Reece
32,867 PointsYes. If you look at the second example here, Adobe.Illustrator is the correct way to define a namespace. You could then have Adobe.Photoshop, Adobe.Acrobat etc. as namespaces.