• 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: Strategy to split up large class files?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Strategy to split up large class files?


  • Subject: Re: Strategy to split up large class files?
  • From: Arthur Clemens <email@hidden>
  • Date: Fri, 2 Jul 2004 22:52:11 +0200

Mario

thanks for your information. This seems like a sensible method (division of UI controller objects and notifications).

Arthur Clemens


On Jul 2, 2004, at 1:12, Mario Diana wrote:

On Wednesday, June 30, 2004, at 07:26 AM, Arthur Clemens <email@hidden> wrote:

Is there a strategy to split up my AppController class in smaller chunks [...]?

I had a fairly complicated GUI for an application I was working on, and I didn't like the idea of putting all of its functionality into one controller class. At the same time, there was a complicated model backing the data that the GUI displayed. This is what I did.

In InterfaceBuilder I made a primary controller object, and then several secondary controller objects to govern various tabs, tables and so forth. I then made whatever outlets I needed for the controllers to communicate among one another as necessary.

To load the data I used notifications. I had the primary controller register itself as an observer for when each of the secondary controllers would -awakeFromNib. I registered the primary controller during its -init method (which comes before -awakeFromNib). Then, as each secondary controller received -awakeFromNib, I had it send a notification that it had awakened, sending itself as the object. The primary controller would receive the notification and call back to the controller that had sent it, sending it the model, which the secondary controller could then use to load the data for which it was responsible.

It seemed like a decent way to divide the work of the GUI among various classes and keep things manageable. (Your mileage may vary!)

Hope this helps!

Mario

=======================================================
Mario Diana Mobile: 845-380-8428
50 Forest Drive Home: 845-221-3989
Poughquag, NY 12570 Email: email@hidden
=======================================================
Programmer - Web development, Java, XML, LAMP, Mac OS X
=======================================================
_______________________________________________
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.


References: 
 >Re: Strategy to split up large class files? (From: Mario Diana <email@hidden>)

  • Prev by Date: Re: Mixing Objective-C and C++ in Xcode
  • Next by Date: Re: Object class name/setObjectClass in NSController
  • Previous by thread: Re: Strategy to split up large class files?
  • Next by thread: md5 for Cocoa / Linker problems
  • Index(es):
    • Date
    • Thread