• 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: More stoopid questions...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: More stoopid questions...


  • Subject: Re: More stoopid questions...
  • From: Kyle Sluder <email@hidden>
  • Date: Sat, 13 Nov 2010 18:00:15 -0800

On Nov 13, 2010, at 5:35 PM, William Squires <email@hidden> wrote:

> 1) Why is it, when you create a new Cocoa Application (or even some iOS Applications) in Xcode, does it generate <blahblah>AppDelegate (.h and .m) files, instead of calling them <blahblah>Controller (.h and .m)? Since these tie to the <blahblah>.xib - according to MVC paradigm - shouldn't it be a controller object for the view(s) in the xib (a controller that just so happens to be a delegate)? After all, it's not called the MVD (Model-View-Delegate) paradigm! Yeah, I realize this is just a stylistic thing, but hey, it gives me an excuse to ask this question! Likewise, when you open the xib in IB, you see a proxy object called <blahblah> App Delegate. Again, shouldn't this be <blahblah> Controller to maintain the 'feeling' that you're designing according to the MVC paradigm?

The controller layer is a very thick layer, containing many kinds of objects. The purpose of the class created for you is to act as the (NS|UI)Application's delegate, and it conforms to that protocol accordingly.

Every controller object in your app could be described as a "MyAppController." "MyAppApplicationDelegate" names the class with the specific role of its instances.

The thing in the nib isn't a placeholder. That's the actual app delegate instance.

>
> 2) How come some NSControls have both a delegate API and a data source API? I'm thinking mostly of NSTableView and its ilk, such as UITabView. Why not just have one delegate API that has the data source 'messages' in that implemented protocol?

Because it can be handy to have different objects fulfill each of these roles. You might have a strictly data-related controller act as the data source, but have the window controller fulfill the delegate role.

--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

References: 
 >More stoopid questions... (From: William Squires <email@hidden>)

  • Prev by Date: Re: NIB doesn't link to objects
  • Next by Date: Re: Problem saving in a Core Data application
  • Previous by thread: More stoopid questions...
  • Next by thread: Re: More stoopid questions...
  • Index(es):
    • Date
    • Thread