Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9143217
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T09:58:07+00:00 2026-06-17T09:58:07+00:00

I was wondering how to create a namespaced object using SproutCore’s OOP implementation. I’ve

  • 0

I was wondering how to create a namespaced object using SproutCore’s OOP implementation. I’ve worked with Joose in the past and namespaces are automatically generated, for example:

Class('MyNamespace.AnotherNamespace.ClassName',{})

But in SproutCore, it looks like you may have to create the individual objects yourself? I feel like that’s a bit tedious. Am I missing something?

Any help would be greatly appreciated.

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T09:58:08+00:00Added an answer on June 17, 2026 at 9:58 am

    SproutCore classes are just as easy to create: SC.Object.extend({…}). And any unreserved property of any object can be treated as a namespace. Just drop in an SC.Object (SC.Object.create). Per hvg’s answer, you can declare it when the Application is instantiated, or later in another file:

    MyApp.SubNamespace = SC.Object.create({
      ClassName: SC.Object.extend({...}),
      OtherClassName: SC.Object.extend({...})
    });
    

    This isn’t much more code than your Joosie example. Your observation that the namespace isn’t automatically created for you is correct, but that has semantic benefits: you can define all of the namespace’s contents at the same time that you create it, which encourages the centralization of code; and it prevents the bug where you accidentally autodefine a typoed namespace.

    The key insight here is that your application object is not just a namespace, it’s an active, dynamic instance of a class that provides application-y functionality. The fact that all of your application’s code ought go in the application object creates a sort of natural namespace, and I find that most of the time my sub-namespaces work the same way (myApp.mainPage, myApp.contentController, myApp.remoteDataSource, myApp.statechart). You are certainly welcome to organize your code into dedicated namespaces via a dedicated instance of SC.Object, and I often do, but SC applications tend to self-organize to a high degree.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am wondering if I create an html email with image map, where it
I was wondering how to: create a droplet that saves to a relative filepath.
I was wondering how to create a strong key for AES-256 from the contents
I am wondering how to create my own SOA style messaging system, similar to
Hi I am wondering how to create dynamic drop down lists that get refined
Hi there i am wondering if i create a webapp that uses Spring AMQP.
I was just wondering how to create an editText field on the click of
Just saw a view in iOS settings page, wondering how to create it, it
was wondering how can I create a sub drop down box upon selecting a
Just wondering if it is possible to dynamically create a list of strings in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.