• 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 08:41:49 -0700

On Thu, May 20, 2010 at 8:27 AM, Dave Keck <email@hidden> wrote:
> Which could be solved with a simple if-statement within the subclass'
> -setContent:, allowing you to use accessors everywhere to avoid code
> duplication and giving your subclasses full control over the setting
> of the content property.

You can get away with a lot of things if you don't care about writing
subclass-tolerant code. But since I don't have a crystal ball, I don't
write code which I know will require hacky "isInitialized" flags to be
correct.

Since I didn't write the superclass, I did in fact have to set an
"isInitialized" flag, call -initWithContent: with a nil argument, and
then at the end of my initializer call -setContent: with the object I
intended to call it with originally.

> This issue is highly debated to the point that it is merely a question
> of style. Mike Ash has an excellent article on the topic here:

Mike is overly dismissive of subclassing concerns and KVO. That's
exactly what my overridden -setContent: does.

--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: 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>)
 >Re: Regarding MVC design pattern (From: Kyle Sluder <email@hidden>)
 >Re: Regarding MVC design pattern (From: Dave Keck <email@hidden>)

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