• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Wrapping C functions in Objective C proxy objects: naming convention?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Wrapping C functions in Objective C proxy objects: naming convention?


  • Subject: Re: Wrapping C functions in Objective C proxy objects: naming convention?
  • From: Jonathon Kuo <email@hidden>
  • Date: Thu, 20 Nov 2008 19:08:01 -0800


On Nov 20, 2008, at 5:53 PM, Charles Srstka wrote:

On Nov 20, 2008, at 7:40 PM, Jonathon Kuo wrote:


On Nov 20, 2008, at 5:06 PM, Charles Srstka wrote:

On Nov 20, 2008, at 5:58 PM, Jonathon Kuo wrote:

On Nov 20, 2008, at 2:07 PM, Shawn Erickson wrote:

On Thu, Nov 20, 2008 at 1:23 PM, Jonathon Kuo
<email@hidden> wrote:

Just my 2 cents, but it seems an abuse to turn functions into objects.
Functions don't retain state; objects do. Objective C very gracefully allows
objects to call C functions. If you're doing something like [calc
addDoubleA:a withDoubleB:b], you've got a function masquerading as an
object, which I think misses the entire point of OOP.

It is common, if not appropriate, to have utility classes (often ones
with just class methods) that provide "functions" for others to use.
At a minimum it allows you to namespace sets of utility methods.

Exactly, as classes aren't objects.

Yes they are - in Objective-C, anyway.

Oops, my bad. Meant to say classes aren't instantiated objects (and thus they have no context or state, and so are appropriate for library-type functions, etc.)

Yep. Good thing the built-in Cocoa frameworks don't have any instantiated objects that contain library-type functions. Otherwise, we'd have all sorts of singleton objects with names like NSFileManager, NSWorkspace, NSUserDefaults, NSFontManager...


Well, to be fair, in each class you mention, you're accessing a special object: the default NSFileManager object for the file system, the shared NSWorkspace instance, etc. Those aren't examples of simple libraries in class clothing, which is all I was getting at.

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Wrapping C functions in Objective C proxy objects: naming convention? (From: "Austin Ziegler" <email@hidden>)
 >Re: Wrapping C functions in Objective C proxy objects: naming convention? (From: Jonathon Kuo <email@hidden>)
 >Re: Wrapping C functions in Objective C proxy objects: naming convention? (From: "Shawn Erickson" <email@hidden>)
 >Re: Wrapping C functions in Objective C proxy objects: naming convention? (From: Jonathon Kuo <email@hidden>)
 >Re: Wrapping C functions in Objective C proxy objects: naming convention? (From: Charles Srstka <email@hidden>)
 >Re: Wrapping C functions in Objective C proxy objects: naming convention? (From: Jonathon Kuo <email@hidden>)
 >Re: Wrapping C functions in Objective C proxy objects: naming convention? (From: Charles Srstka <email@hidden>)

  • Prev by Date: Re: GC and print operations cause objects not to finalize?
  • Next by Date: Re: MD5 Checksum of a file with CommonDigest.h
  • Previous by thread: Re: Wrapping C functions in Objective C proxy objects: naming convention?
  • Next by thread: Re: Wrapping C functions in Objective C proxy objects: naming convention?
  • Index(es):
    • Date
    • Thread