• 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: Is encapsulation deprecated in ObjC?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Is encapsulation deprecated in ObjC?


  • Subject: Re: Is encapsulation deprecated in ObjC?
  • From: Lloyd Sargent <email@hidden>
  • Date: Thu, 16 Aug 2001 09:47:48 -0500

I've been into ObjC for a few weeks now and am getting to the point where I
can write real programs. There still is one thing that has me scratching my
head. I read the ObjC.pdf paper and in starts out with the standard
discussion of the benefits of encapsulation. Then I started looking at
sample code and there seems to be an ObjC convention of "Lets define public
accessors for all our instance variables."

I'm not going to argue one way or the other, but apparently in the OOP community there are two camps: one that likes public accessors and others that don't. Personally, I learned that the point of OOP was that you TOLD and object to do something (what I think of as 'active') vs. setting/asking it for its contents (what I think of as 'passive'). However, sometimes that doesn't always fly. For example, how do I determine if a button is in a particular state? Uh, er, I guess I have to ask it for it's value <shuffle's feet and whistles tunelessly>. :^)

The problem is that sometimes ya' gotta have public accessors, IMHO.

So what's going on. Did experience teach that data hiding isn't all that
important or have I just looked at a biased sample?

No, data hiding is still important.

Cheers,

Lloyd
---
Canna Software Development
"This email was created using 100% recycled electrons"


  • Follow-Ups:
    • Re: Is encapsulation deprecated in ObjC?
      • From: Chris Gehlker <email@hidden>
    • Re: Is encapsulation deprecated in ObjC?
      • From: Brian Hill <email@hidden>
  • Prev by Date: Handing off varargs? (Language lawyers, please read.)
  • Next by Date: Re: Online C++ resources?
  • Previous by thread: Is encapsulation deprecated in ObjC?
  • Next by thread: Re: Is encapsulation deprecated in ObjC?
  • Index(es):
    • Date
    • Thread