[wp-hackers] Include popular libs with a function

Sean Hickey seanhickey at gmail.com
Sat Aug 19 17:27:18 GMT 2006


> I don't think we should be including anything we don't use.

Then WordPress would be pretty unique in that attitude.  Development
platforms as a whole -- and make no mistakes, WP is a development
platform -- go out of their way to include reusable code that
developers can use, even if the platform itself doesn't use them.

Microsoft goes out of their way to include controls and APIs that will
be useful to developers, even if Windows doesn't use them.  They want
people to want to develop Windows applications.  So they work to make
Windows an attractive platform to develop on.

> There is nothing stopping a plugin author using the builtin script
> loading functions in 2.1 to add these other libs in the same way the
...
> wp_enqueue_script('dojo', '/wp-content/plugins/myplugin/dojo.js',
> false, '0.01');

That only solves one problem.  That still means every developer needs
to include the libs with their plugin.  That still means a developer
will write a plugin that uses Prototype 1.4, and another developer
will write a plugin using Prototype 1.3.  Both libs will be included
in the document's head, which is wasteful, and adds extra seconds to
rendering the document.

If developers stuck to using what was already included with WordPress,
we wouldn't have that problem.  But since nothing is included with WP,
everyone is forced to home-grow a solution.

This is also about breaking the cycle of reinventing the wheel.  I
don't know about you, but I'm getting tired of rewriting the same
code, over and over again, each time I create a plugin.  It's getting
to the point that I can write half of the plugin's code blindfolded,
because it's the same code I have to keep writing into every plugin,
and I've done it a dozen times.

When you have a situation like that, it's time for the WP devs to step
back and take a good hard look at the API.  Find out what the most
comment tasks are in plugins -- like creating menus or Ajax enabled
plugins -- and build an easy to use framework to streamline those
task.

Including a few more of the common JS and PHP libs helps.  Creating
some additional functions/classes to streamline plugin development
also helps.  Simply exposing the core API isn't enough to satisfy most
developers.  Some code needs to be written/included specifically for
them to use.

- Sean
-- 
http://www.headzoo.com


More information about the wp-hackers mailing list