• 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: Regarding MVC design pattern
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Regarding MVC design pattern


  • Subject: Re: Regarding MVC design pattern
  • From: Kyle Sluder <email@hidden>
  • Date: Thu, 20 May 2010 07:55:59 -0700

On May 20, 2010, at 7:40 AM, Thomas Davie <email@hidden> wrote:

Can I ask why you shouldn't use them in init? It makes a lot of sense to not use them in alloc/dealloc, but I'm not using them in init... after all, what if I replace the ivar with a derived property from another object? Why should I have to recode my init?

I'll give you a concrete example. We have an NSController-like class that lives in a framework. Its designated intializer is - initWithContent:. In one of our apps, we have a subclass of this whose initializer is -initWithDocument:, and which uses the document to figure out its content. It also overrides -setContent: to register for notifications and the like. -setContent: relies on certain state that is set up in -initWithDocument:, but this setup can't be done until - initWithDocument: calls -[super initWithContent:]. But that method uses the -setContent: setter to set its content property. Boom!


--Kyle Sluder
_______________________________________________

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


  • Follow-Ups:
    • Re: Regarding MVC design pattern
      • From: Dave Keck <email@hidden>
References: 
 >Regarding MVC design pattern (From: Sai <email@hidden>)
 >Re: Regarding MVC design pattern (From: Henry McGilton <email@hidden>)
 >Re: Regarding MVC design pattern (From: Sai <email@hidden>)
 >Re: Regarding MVC design pattern (From: Jack Nutting <email@hidden>)
 >Re: Regarding MVC design pattern (From: Sai <email@hidden>)
 >Re: Regarding MVC design pattern (From: Kyle Sluder <email@hidden>)
 >Re: Regarding MVC design pattern (From: Sai <email@hidden>)
 >Re: Regarding MVC design pattern (From: Jack Nutting <email@hidden>)
 >Re: Regarding MVC design pattern (From: Joanna Carter <email@hidden>)
 >Re: Regarding MVC design pattern (From: Sherm Pendley <email@hidden>)
 >Re: Regarding MVC design pattern (From: mmalc Crawford <email@hidden>)
 >Re: Regarding MVC design pattern (From: Thomas Davie <email@hidden>)

  • Prev by Date: Re: Simulating Text Input
  • Next by Date: Re: Simulating Text Input
  • Previous by thread: Re: Regarding MVC design pattern
  • Next by thread: Re: Regarding MVC design pattern
  • Index(es):
    • Date
    • Thread