• 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: Plugin design question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Plugin design question


  • Subject: Re: Plugin design question
  • From: Ondra Cada <email@hidden>
  • Date: Wed, 11 Sep 2002 19:13:38 +0200

On Wednesday, September 11, 2002, at 06:08 , Drew McCormack wrote:

I want to make a modular application that utilizes plugins as much as possible. Each plugin will basically be a filter, which acts on a model (data) object. The model objects must be in the main application, but will also need to be accessed within the plugins (of course). My question is: how do I incorporate the model classes into the plugin?

1) I could just include the header file, but then linking would fail for the plugin, right?

You can use some workarounds (like, to "link against" the app directly), but it's still messy.

2) I guess I could create a framework with my model class, and add that to the main application, and plugins. Is this the usual approach? Shame to have to build an extra framework with only a few classes though.

Shame indeed, and never it was needed till the darned two-level namespace occurred :((( Nevertheless, so far as I can say, today it is the recommended and cleanest solution of all possible ones (presumed, that is,
you can't afford just to switch two-level namespace off).

3) I could make a protocol corresponding to each of my model classes, and just use the protocol header in the plugins.

Depends on whether you ever need to prepare a base class in the application, and its concrete subclass in the bundle. If so, oops (well, again there are workarounds, and again they are messy -- like embedding instead of subclassing). If not, protocols are a nice way to go.

This would work, I think, but it seems ugly to have to make a protocol for each class you want to use.

Make a protocol for each _functionality_, which is all right. Let the developer decide how to implement them: in some cases it might be reasonable eg. to make just one class which would implement the functionalities of all the protocols...

What is the standard way of approaching this problem?

I am afraid the frameworks are :(
---
Ondra Cada
OCSoftware: email@hidden http://www.ocs.cz
private email@hidden http://www.ocs.cz/oc
_______________________________________________
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: 
 >Plugin design question (From: Drew McCormack <email@hidden>)

  • Prev by Date: Re: contextual menu with unicode characters
  • Next by Date: Re: argh...linking problems with AppleShare client lib
  • Previous by thread: Plugin design question
  • Next by thread: Re: Plugin design question
  • Index(es):
    • Date
    • Thread