• 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: Where to put dataSource routines
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Where to put dataSource routines


  • Subject: Re: Where to put dataSource routines
  • From: Julian Barkway <email@hidden>
  • Date: Thu, 25 Apr 2002 18:12:56 +0200

On Thursday, April 25, 2002, at 01:14 pm, Bill Cheeseman wrote:

The reason I'm torn is it seems like it should be in the controller, but if
I do that, I'd put them there and probably write virtually the same methods
in the data object and the controller routines would be a cover for them. So
why not just put them in the data object, even though in MVC a data object
shouldn't be talking directly with a view?

What's the way to go?

I've done it in two ways: (1) create a separate datasource class for the
datasource methods, or (2) put them in the window controller. The latter is
easier, because the window controller typically already has access to the
view and the model, both of which are needed to implement the datasource
methods. Also, it feels the most appropriate because, as you say, the
datasource methods are really controller methods.

Why not place all the data source methods in a separate source file but with their own specific category within the controller class? This way you get the advantages of physical separation combined with the advantages of logical coupling. That's how I do it.
_______________________________________________
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.
  • Follow-Ups:
    • Re: Where to put dataSource routines
      • From: Bill Cheeseman <email@hidden>
References: 
 >Re: Where to put dataSource routines (From: Bill Cheeseman <email@hidden>)

  • Prev by Date: NSCopyObject
  • Next by Date: Window menu
  • Previous by thread: Re: Where to put dataSource routines
  • Next by thread: Re: Where to put dataSource routines
  • Index(es):
    • Date
    • Thread