Books or articles on scripting/plug-ins patterns?

Started by
3 comments, last by skanatic 19 years, 4 months ago
I've been looking and looking for articles and books which would relate to theories behind creating a scriptable-program. But there doesn't seem to be any. I'm not searching for stuff which says "In c++ create a class like this and then do this" but stuff which contains "There is 3 ways to implement a plugin-support for your program. The first way is plaaplaaapla". Is there actually any studies or theories behind scripting/plugins?
Advertisement
The problem is that it totally depends on your program. Some people will want run-time scripting, where others might only need to execute scripts at start up. Some scripts are complete imperative languages and others are more declarative and data-like. And the subset of game features that you can script might range from almost the entire game engine, to maybe just NPC AI. And the scripting requirements of games would differ from those of a 3D rendering package or a development environment (for example). So it would be very hard to come up with any kind of procedure that would apply to all or most programs, any scripting language, and any main programming language.

Plugin systems tend to be simpler to make as you're essentially just delegating a certain set of functions to an external library. Usually it's quite obvious from your program design which functions can go in the dll but again there isn't any sort of general rule. A Winamp plugin will export an entirely different set of functions compared to a 3D Studio Max plugin.

Once you define your problem a bit more precisely, and specify what you need to script, and what sort of language you want, you may find that the existing documentation does the job.

At a very basic level all you're doing is transferring some of the control flow from being code-driven to being data-driven, where the data in question is essentially code written in a secondary language. Program control flow can be handled in an infinite number of ways and therefore how to handle the scripting can vary just as much.
Thanks for the reply.

I've been going around and around the problem for sometime (actually almost a year. Now the situation requires that I write a research about the subject so that's why I'm looking for some "professional" studies). In the end I decided that I need a program which user can expand by downloading plug-ins. So basically what I require is something like the plugin-system in Eclipse. I'm hoping to find a design pattern or two about the subject. Suprisingly ACM gave me nothing.

But, I'll keep looking.
Hmm. I guess the checklist for an IDE add-in would go something like:

- In the host program, provide function hooks or an object model that can be passed to other code to manipulate
- In the add-in, provide an interface that can be called from the original program (eg. a list of functions)
- In the add-in, also provide a list of UI alterations (eg. menu items, toolbars, etc) along with references to the functions it calls in the provided interface
- Then, when loading the add-in, pass a reference to the object model or function hooks to the add-in code and set up the UI elements as specified.

As before, what part of your object model you expose is entirely up to you.

You might also consider more rigorous and standard ways of specifying interfaces like IDL, or component object architectures like COM or CORBA.
Have you looked at the "Simple Plugin Layer"? Perhaps you can get some ideas from there...

http://www.unitedbytes.de/go.php?site=spl

/skanatic

This topic is closed to new replies.

Advertisement