• 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: Q: how do you generate get/set methods?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Q: how do you generate get/set methods?


  • Subject: Re: Q: how do you generate get/set methods?
  • From: Daniel Jalkut <email@hidden>
  • Date: Tue, 20 Jan 2004 17:59:06 -0800

Keep in mind that many people are in the habit of providing accessor methods for their instance variables even if the variables are kept private. It can be reassuring to know that even the object itself is going through a bottleneck when it gets or sets the value of the variable.

Daniel

On Jan 20, 2004, at 5:01 PM, Karl Goiser wrote:

Without wanting to act like a wet blanket, I would like to point out that one of the foundation principles of object oriented programming is 'encapsulation'. This is the idea that one object should not know about the internal state of another. This is a well established design principle and is fundamentally important in writing large, well behaved applications. For example, a driver of a vehicle is not, and probably should not be appraised of every piece of information a modern engine management system gathers.

Personally, I regard the automation of accessor method writing as counter this principle. Large numbers of accessor methods, to me, are an indication of poor design and a potential source of problems and unnecessary complexity. For example, if a method in object A needs to make many accessor calls to object B, that method may be better placed in object B - and reduce the need for the accessor methods.


Good programming everybody!


Karl
_______________________________________________
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.

References: 
 >Q: how do you generate get/set methods? (From: Alexander Spohr <email@hidden>)
 >Re: Q: how do you generate get/set methods? (From: mmalcolm crawford <email@hidden>)
 >Re: Q: how do you generate get/set methods? (From: Karl Goiser <email@hidden>)

  • Prev by Date: Re: *****SPAM*****How to convince company I should switch to Cocoa
  • Next by Date: Re: Panther's Crash Reporter
  • Previous by thread: Re: Q: how do you generate get/set methods?
  • Next by thread: Re: Q: how do you generate get/set methods?
  • Index(es):
    • Date
    • Thread