How to tell when the engines plugin might be useful

It’s often not clear to people when it might be appropriate to develop a plugin that uses functionality from engines, rather than a generator. Here are some good rules of thumb.

Is this code going to be used in multiple applications?

The ‘point’ of the engines plugin, so to speak, is to allow reuse of code between multiple applications. If you’re never going to need your MagicWidgetX again, why bother?

Can the functionality of your module be reasonably isolated?

Can all the libraries, models and controllers be put into modules? This makes it much easier for other people to use your code. Plus it’s just good practice.

Do you want to include views as well as models/controllers/libraries?

Engines-aware plugins can include views which work without being placed in the normal application directory

Are Generators an unsuitable solution?

Traditionally, the way to distribute models, controllers and views in a single package would be using a Generator. However, engines have a number of significant advantages over Generators, including but not limited to:

  • Application-specific changes are isolated from the plugin code
  • Engines-aware plugins can be updated, and updates easily propagated to many applications

See Engines vs. Generators for more discussion.

Does your envisioned module need to define some aspect of the application database schema?

Engines-aware plugins include migration support out of the box.