Hello all,
I'll coin in my two cents on creating a "plugin" ecosystem for
Joomla!. This is actually what is required to achieve most of the
items on that list, including loading of Javascript libraries,
abstracting things such as comment form loading, implementing
overridable/replaceable UI elements, centralized system for managing
loading of CSS and JS files and even avoiding bad programming
habits. Why plugins? Because plugins can be used as the building
code blocks of our sites, are easy to manage and can be triggered on
custom events. Alternatively, we could use a custom library but
installing it automatically would be hard unless we focus on Joomla!
1.6+ only.
The main problem arising is different extensions requiring or
distributing different versions of the plugins/library used. I
currently have this issue with extensions based on Nooku. For
instance, Lifestream requires and installs an old snapshot of Nooku
0.7, whereas Ninjaboard requires and installs an almost up-to-date
trunk snapshot of Nooku. These two are incompatible with each other.
I had to choose which one to use and which one to let go. I had to
ditch Lifestream, which came with the cost of having to provide an
alternative solution. Imagine what would happen if each template,
component, module and plugin tried to install a different version of
the abstraction API plugins/libraries we are discussing here. It'd
be nothing sort of a Babel tower.
So, in order to be successful, we need to ensure the following
prerequisites are met by our plugins/libraries:
- Future-proof. The exposed API should be immutable, or
provide backwards compatibility whenever it's updated. We should
do it like Microsoft did in the transition from Windows 3.1 to
Win32s to Windows 95 to Windows XP to Windows Vista. By
providing a backwards compatible API, applications written for
Windows 3.1 were easily ported to Windows Vista with minimal
changes (only about the parts which had to go away).
Diametrically opposite to this approach is Joomla! 1.0 to 1.5 to
1.6. Each of those version changes completely screwed up our
code and we had to make extensive changes. IMHO, only the 1.0 to
1.5 upgrade was justified for breaking the site. The 1.5 to 1.6
was a blunder. APIs changed for no reason and caused a lot of
grief. Let's not do that.
- Dependency tracking. We need a method to track down
dependencies. For instance, my extension should indicate that it
depends on jQuery and jQuery UI. If they are not available they
should be installed, transparently. This is similar to a Linux
distribution's package management system. I have proposed a
possible structure for such a component as a Nooku Incubator
proposal.
- Warn and roll-back. Continuing from the previous point,
if an extension installation is bound to cause an issue - e.g.
it requires and supports only older versions of, say, jQuery
than other parts of the system - the user should be warned that
this may cause his site to break. While at it, it should also
make sure that a backup of the changed files is kept and, if
hell breaks loose, the user should be able to roll back to it.
Think of this as the Windows' System Restore Points idea brought
to the web. Considering that the site may be bricked, it would
also be a good idea to provide an off-Joomla! way to restore
those system restore points, much like booting with your Windows
installation DVD allows you to run System Restore and roll back
to a last known good state.
To sum it up, we have three problems to solve:
- The Library. The core of what we are discussing.
- The Installer. Because Joomla!'s own installer can't
handle dependency tracking and roll-back.
- Adoption. Just because we build it, it doesn't mean
they will come. We will need big projects and clubs migrating to
our solution and eventually having Joomla! itself adopt this
solution. The former is difficult, but doable. The latter is
less likely to happen than a snow storm in Sahara, pigs learning
to fly or hell freezing over.
Feel free to comment on my rants :)