Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Should I go back and prefix my class names? (Obj-C/Cocoa)

Should I go back and prefix my class names? (Obj-C/Cocoa)
Thread Tools
Mac Enthusiast
Join Date: Nov 2001
Status: Offline
Reply With Quote
Sep 3, 2002, 03:58 AM
 
Ah! I started a project a few months ago, and originally thought that it would be a small project, so (in my lack of foresight) I named my classes willy-nilly. Now, many classes will be public, along with notifications, constants, etc. There are about 50 classes in my project. I'm just wondering whether people think it is worth the effort to go back and prefix my class names/notifications/whatever?
     
Professional Poster
Join Date: Oct 2001
Location: London
Status: Offline
Reply With Quote
Sep 3, 2002, 05:59 AM
 
Originally posted by Ibson:
Ah! I started a project a few months ago, and originally thought that it would be a small project, so (in my lack of foresight) I named my classes willy-nilly. Now, many classes will be public, along with notifications, constants, etc. There are about 50 classes in my project. I'm just wondering whether people think it is worth the effort to go back and prefix my class names/notifications/whatever?
If they are going to be public - absolutely.
     
Ibson  (op)
Mac Enthusiast
Join Date: Nov 2001
Status: Offline
Reply With Quote
Sep 3, 2002, 06:04 AM
 
Should I bother prefixing my private classes? Also, would one tend to use a company-specific prefix or an application-specific prefix (I've seen examples of both).

*sigh* I'll start now then...
     
Addicted to MacNN
Join Date: Mar 2000
Location: London, UK
Status: Offline
Reply With Quote
Sep 3, 2002, 12:54 PM
 
If they're specific to your app, use an app-specific prefix. If you want them to be reusable in other applications, you can use a company or person-specific (if you're just working along) prefix.
     
Clinically Insane
Join Date: Oct 2001
Location: San Diego, CA, USA
Status: Offline
Reply With Quote
Sep 4, 2002, 02:02 AM
 
Originally posted by Ibson:
Should I bother prefixing my private classes? Also, would one tend to use a company-specific prefix or an application-specific prefix (I've seen examples of both).

*sigh* I'll start now then...
Couldn't you just use Project Builder's built-in find-and-replace ability? It seems like it wouldn't be that hard with that.
Chuck
___
"Instead of either 'multi-talented' or 'multitalented' use 'bisexual'."
     
Forum Regular
Join Date: Oct 2000
Location: Portland, OR USA
Status: Offline
Reply With Quote
Sep 6, 2002, 06:41 PM
 
Isn't there some way to create a namespace around our classes?! Like a package in Java or namespaces in C++. This is the only thing I dislike about Objective C.
     
Ibson  (op)
Mac Enthusiast
Join Date: Nov 2001
Status: Offline
Reply With Quote
Sep 6, 2002, 07:29 PM
 
Originally posted by LordJavac:
Isn't there some way to create a namespace around our classes?! Like a package in Java or namespaces in C++. This is the only thing I dislike about Objective C.
Unfortunately, no. The Objective-C runtime has a single, flat namespace per process for all exported symbols: such as global variables, class names, nonstatic functions, and categories. Protocols have a separate global name space of their own.
     
Dedicated MacNNer
Join Date: Jan 2001
Location: Meida, PA USA
Status: Offline
Reply With Quote
Sep 7, 2002, 05:38 PM
 
I *think* two level namespases were intro-ed in 10.1 although I've never really tried it...

http://developer.apple.com/techpubs/...amespaces.html

Maybe it's language specific, meaning for use in Obj-C++ only??
~ Mike
--
Personal Site: MikeZornek.com
Other Interests: WebDevWiki.com
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 01:44 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2