• 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: Plug Ins - To Subclass or to Protocol?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Plug Ins - To Subclass or to Protocol?


  • Subject: Re: Plug Ins - To Subclass or to Protocol?
  • From: Glenn Andreas <email@hidden>
  • Date: Thu, 22 Jul 2004 15:49:04 -0500

At 5:27 PM -0400 7/21/04, Lee Morgan wrote:
I'm working on a app that uses plug-in extensively.

And I need to decided if I should...
Create a class that plug-in developers would sub-class to make a
plug-in?
Or define a protocol that the plug-in will have to follow?

You could do both - declare a protocol, and then make a class (subclass of NSObject) that adopts that protocol (note that the calling app would only care about the API defined in the protocol, and not about any class membership).

The advantage of this is that often times there is additional utility methods that many plugins might use and by defining the class you can provided those (but not require the plug-in writer to have to subclass - it's just useful if they do). This is especially useful since protocols provide any default behavior (so if a protocol specifies twenty different routines, most of which have reasonable default return values, you can provide those in the class).

--
Glenn Andreas email@hidden mondo blobbo, Cythera, Theldrow, oh my!
Mad, Bad, and Dangerous to Know
_______________________________________________
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: 
 >Plug Ins - To Subclass or to Protocol? (From: Lee Morgan <email@hidden>)

  • Prev by Date: Re: ZeroLink Errors
  • Next by Date: Re: Java and MacOS
  • Previous by thread: Re: Plug Ins - To Subclass or to Protocol?
  • Next by thread: Bindings and Buttons
  • Index(es):
    • Date
    • Thread