• 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: NSController revisited
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSController revisited


  • Subject: Re: NSController revisited
  • From: Scott Anguish <email@hidden>
  • Date: Tue, 4 Nov 2003 17:44:50 -0500

On Nov 4, 2003, at 9:46 AM, Stiphane Sudre wrote:

On Tuesday, November 4, 2003, at 03:25 PM, Aaron Hillegass wrote:

After many demonstrations of the power of NSController ("Aaron, this app was 252,500 lines of code, but with NSController it is only 3!"),

I'm particularly interested by this point.

NSController(252,500) = 3;

Can it be possible to have the conversion ratio on the number of outlet connections?


I'm assuming that Aaron was exaggerating slightly here.. :-)

In my talk I did go over a real-world case of converting the OpenUp Preferences panel to using NSUserDefaultsController. The only reason for the lines that exist code wise is to set up the initial default values, and handle the "set file location" button functionality.

From the slides (http://homepage.mac.com/sanguish/ORA-2003/ControllerTalk-ORA2003.pdf)

Results
PrefsController class
Without controller - .h 61 lines /.m 346 lines
With controller - .h 30 lines / .m 80 lines
30 minutes to do
Less if I could remember the preferences keys I had used

Breakdown
PrefsController.h
All but one IBOutlet was removed (preferencesPanel)
Most of the glue code declarations were removed
PrefsController.m
removed 75% of the code in the .m
Provides initial values for defaults (was in AppDelegate)
Modified the existing file/directory selecting method
Three small target methods to call file/directory selecting method with the correct preferences key

And you get a huge win when it comes to dealing with NSTableView selection behaviors. I was going to code an example that did what the controllers does using the standard methods, but didn't have time (and it would have taken a while).


I also want to say that I appreciate Aaron's posting a follow-up here. And he was also most gracious when asked for his opinion during my talk.

http://homepage.mac.com/sanguish/ORA-2003/FoundationURLAPI-2003.pdf
http://homepage.mac.com/sanguish/ORA-2003/SafariWebKit-2003.pdf
_______________________________________________
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: NSController revisited (From: Stéphane Sudre <email@hidden>)

  • Prev by Date: Running an App as Root
  • Next by Date: Re: Plug-in & Framework
  • Previous by thread: Re: NSController revisited
  • Next by thread: Re: NSController revisited
  • Index(es):
    • Date
    • Thread