RE: Private methods in ObjC
RE: Private methods in ObjC
- Subject: RE: Private methods in ObjC
- From: "Jason Vowell" <email@hidden>
- Date: Wed, 25 Feb 2004 10:23:30 -0600
I'm no expert, but this is my observation.
The long answer...
Objective-C takes a different approach from Java, C#, and other modern
programming languages, in that it does not overtly enforce paradigms upon
the programmer through keywords and other language constructions. Rather,
Objective-C leaves much (if not most everything) open to the programmer and
takes more of a "by convention" approach. You as a programmer are not
restrained much at all by the language constructs, because there are few of
them. In effect Objective-C "respects" the programmer and assumes that she
knows what she is doing, i.e. if a method is not declared within a
@interface, she knows that it might be subject to change and she ought not
to use it.
The short answer...
Go with number 1 of your list if you're from the Java, C# perspective.
Go with 3 if you're coming from the Objective-C perspective.
Jason
-----Original Message-----
From: email@hidden
[
mailto:email@hidden] On Behalf Of Glen Low
Sent: Wednesday, February 25, 2004 6:49 AM
To: Cocoa-Dev Apple
Subject: Private methods in ObjC
Dear All,
I note there's no direct way of making your ObjC methods private to
clients. What's the usual idiom for doing this?
1. Define a category on the object and put it into the .m file?
2. Declare methods in the interface but preface them with something?
3. Don't declare the methods in the interface, but simply use them from
your code. Presumeably then you have to define those private methods
first in the .m implementation before you call them?
4. Put comments like "don't touch!" -- just joking...
5. Any funky techniques like multiple interface declarations?
Cheers, Glen Low
---
pixelglow software | simply brilliant stuff
www.pixelglow.com
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.