• 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: A hillegass challenge
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: A hillegass challenge


  • Subject: Re: A hillegass challenge
  • From: Greg Guerin <email@hidden>
  • Date: Fri, 4 Dec 2009 10:46:19 -0700

Michael de Haan wrote:

My question pertains to knowingly setting an object to NULL and then knowingly sending it a message as an acceptable technique. (If this is not done, drawRect will simply show the oval as if it was still being actively drawn).


Also see:

http://en.wikipedia.org/wiki/Null_Object_pattern

In this particular case, it's probably overkill to create a do- nothing class. Other circumstances might make it more sensible. For example, you have a collection that can't contain nil, yet you still need the do-nothing behavior from contained objects.

I also recommend changing your comment from the self-evident "sets the current bezierPath to nil", to instead give the REASON for setting bezierPath to nil, e.g. "a nil bezierPath always does nothing in drawRect:".

  -- GG

_______________________________________________

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


  • Prev by Date: Re: applicationShouldTerminate problem
  • Next by Date: Re: Why is "set" a class method of NSColor?
  • Previous by thread: Re: A hillegass challenge
  • Next by thread: Re: NSSpellChecker and checkSpellingOfString problems (solved... embarrassingly)
  • Index(es):
    • Date
    • Thread