Apart from not cluttering the global namespace and gaining the ability to encapsulate code in private members, is there any benefit?
Apart from not cluttering the global namespace and gaining the ability to encapsulate code
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Yes you’re right. Apart from the benefits of namespaces, there are no benefits of namespaces.
But be sure to consider what would happen if you later do add more external scripts, or make your own scripts more complicated. Namespaces are quite light and easy to set up, and it’s never harmful to be tidy from the start.