Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [babel-dev] Help on PHP to load a plugin system

Here is how wordpress deal with plugins:

http://codex.wordpress.org/Writing_a_Plugin#WordPress_Options_Mechanism

add_option($name, $value, $deprecated, $autoload);

Then you get the option like this:
get_option($option);

So we can do something like:
1. Define my own function that satisfies an API
2. Register the function
3. Call the function programmatically.

The API is going to be more work, we will need to document it. I am happy with keeping an agile development style as long as we can for this ; we can break often, as long as we know we do.

That still leaves three options:
1. Externalize part of the current code in functions called by the API, without an inheritance system. Clients who want to use the API must implement it all.
2. Make the Babel Eclipse code the default choice, ie, if the custom function is missing, use the Babel one instead. It can be a bit sneaky.
3. Don't externalize the Babel Eclipse code, and make it the default choice as well.

I tend to think 1. is the way to go.

I also think we can use a test driven approach in this to help developers implement the API correctly.

What do you think ?

Thanks,

Antoine 

On Tue, Dec 16, 2008 at 10:35 PM, Denis Roy <denis.roy@xxxxxxxxxxx> wrote:
I think override_function is essentially used for overriding built-in PHP functions.

I think a good strategy would be to examine how Wordpress and/or MediaWiki deal with plugins.  I'm really not an expert on this subject.

Denis





Antoine Toulme wrote:
I see two ways of doing it, though, and that's where my PHP skills fall short:
either we move all the eclipse specific code in a particular folder, and we load its functions at runtime, or we keep the current code, and we give the ability of people to override.

In case 1, we'd have:
ext/
  eclipse/
    functions_for_authentication.php
  intalio/
    functions_for_authentication.php

In case 2, the function for authentication is by default the one from eclipse, and we load a file that may contain an override_function call: http://www.phptutorial.info/?override-function
I feel case 2 is going to be quirky and buggy.
Case 1 demands more refactoring, but less work for people to come, copy and customize the files for their own needs.

What do you prefer ?

Thanks,

Antoine


On Tue, Dec 16, 2008 at 3:31 PM, Denis Roy <denis.roy@xxxxxxxxxxx> wrote:
+1

The plugin mechanism is usually how it's done.  Now is likely the best time to do it while the codebase is still small.

Denis



Antoine Toulme wrote:
So, as discussed on last week call, I have a vested interest on making Babel consumable by other organizations than Eclipse.

Ideally, I'd like to be able to check out the Babel code and complement it with more files that would be placed in a specific folder.
Those files would contain function definitions that would override some specific function definitions in the Babel code.

Is this a realistic use case ? Denis, Gabe, did you have to face before a situation where you had to plug code like this ?

What would you think of such an architecture ?

Thanks,


_______________________________________________ babel-dev mailing list babel-dev@xxxxxxxxxxx https://dev.eclipse.org/mailman/listinfo/babel-dev

_______________________________________________
babel-dev mailing list
babel-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/babel-dev




--
http://www.lunar-ocean.com/blog


_______________________________________________ babel-dev mailing list babel-dev@xxxxxxxxxxx https://dev.eclipse.org/mailman/listinfo/babel-dev

--
Denis Roy
Manager, IT Infrastructure
Eclipse Foundation, Inc. -- http://www.eclipse.org/
Office: 613.224.9461 x224 (Eastern time)
denis.roy@xxxxxxxxxxx

_______________________________________________
babel-dev mailing list
babel-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/babel-dev




--
http://www.lunar-ocean.com/blog


Back to the top