• 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: ADC Core Data article
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ADC Core Data article


  • Subject: Re: ADC Core Data article
  • From: Charlton Wilbur <email@hidden>
  • Date: Fri, 8 Apr 2005 12:34:22 -0400


On Apr 8, 2005, at 11:17 AM, Shawn Erickson wrote:

The definition of object-oriented or object appears to be (and is) a rather subjective thing... having accessors can been seen as exposing what is in an object which some consider to be very much unobject like (one very small step from a structure, yeah yeah I know you inject logic in accessor, etc. so they don't really have to expose the internals) similar things can be said about NSManagedObjects interface, and on and on.

Well, that's the thing -- you don't *know* whether [employee name] is exposing an instance variable, or making a database call, or calculating a value. The sensible implementation in most cases is to expose an instance variable, but that's not required. And the same thing is true of [employee valueForKey: @"name"].


The last time we had a similar discussion on object-oriented orthodoxy, I demonstrated fairly clearly that Objective-C messages and key-value coding are isomorphic ways of communicating with an object. There is nothing you cannot do with key-value coding that you cannot also do with messages, and there is nothing you cannot do with messages that you cannot also do with key-value coding. As such, preference between key-value coding and message sending cannot logically be about expressive power or capability unless that isomorphism is refuted (and it was not in the prior thread); it must be about performance and aesthetics.

Claim that you do not *like* KVC, and I won't quibble. Claim that it's slower than message sending, and I won't quibble. Claim that there are more elegant ways of accomplishing some things, and I won't quibble on substance though I may disagree on particular instances. Hell, you can even claim that Apple isn't using the power of KVC to its fullest -- I certainly won't disagree on that! But don't try to portray aesthetic preference as an absolute good, especially when your aesthetic preference shifts work from the computer to the programmer.

So I think this side of the discussion is pedantic... it is better to say you prefer a particular style of interface to your model data and leave the talk of object-oriented, objects, and messages out of it... since NSManagedObject is an object in the Objective-C sense, it encapsulates data, it supports messaging to get at this data, etc.

My suspicion here is that the people who are claiming that KVC is _ipso facto_ not object-oriented are cleaving to a particular ideal of aesthetic purity, and aesthetic purity is the first thing to be sacrificed when a concept leaves the laboratory. The real world is complicated and messy and does not lend itself to orthodoxy.


Charlton


-- Charlton Wilbur email@hidden email@hidden email@hidden

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: ADC Core Data article
      • From: Marcel Weiher <email@hidden>
    • Re: ADC Core Data article
      • From: Scott Ellsworth <email@hidden>
References: 
 >Re: ADC Core Data article (From: Philippe Mougin <email@hidden>)
 >Re: ADC Core Data article (From: Shawn Erickson <email@hidden>)

  • Prev by Date: Re: event/notification for focus?
  • Next by Date: NSSplitView
  • Previous by thread: Re: ADC Core Data article
  • Next by thread: Re: ADC Core Data article
  • Index(es):
    • Date
    • Thread