Engine best practices

Never worked with engines before so maybe there are some tricks I’m
not familiar with. Say you have a decent sized engine. Before too
long you take the chance of creating naming conflicts with the app
that uses your engine.

The best way I can think of to deal with this is to put everything in
a namespace. Are there any other solutions I’m not thinking of?

Chris

On Aug 6, 4:03 am, snacktime [email protected] wrote:

Say you have a decent sized engine. Before too
long you take the chance of creating naming conflicts with the app
that uses your engine.

The best use-case for taking advantage of the engines plugin is when
you are sharing focused pieces of functionality:

a) that you have written yourself
b) between several of your own applications.

This means that you, the developer, are entirely in control of the
namespace in which all of this code exists, and you can then deal with
any clashes when they occur.

In my experience, these namespace issues have never occurred; I’d
attribute this to keeping the plugins we share relatively small (one
controller, a couple of models) and with a clear area of
responsibility (i.e. accounts, job processing, importing).

If you want to share larger chunks (a forum seems to be popular at the
moment), this is going to be tricker, but reasonably careful design of
the forum classes (yes, probably with namespacing and careful routing)
should make this possible. The point is, if you want to share larger
codebases with relatively certainty that there won’t be any namespace
problems, you ought to own all the code you’re using.

  • James