Plugins and Per-Application Mappings

3 views
Skip to first unread message

Tony Nelson

unread,
Jun 1, 2011, 2:58:08 PM6/1/11
to ColdMVC
If you add a plugin to your application, ColdMVC will automatically
create a per-application mapping that points to the plugin so that
your application can easily access the plugin's components/views/
helpers/etc. I'm looking for feedback on what that mapping should be.

For example, let's say you're using the Markdown plugin (https://
github.com/tonynelson19/ColdMVC-Markdown).

Currently, ColdMVC will create a mapping for "/plugins/markdown/" that
points to the plugin, similar to the following:

this.mappings["/plugins/markdown/"] = "c:\inetpub\wwwroot\plugins
\markdown\";

If you wanted to then create a new instance of the
MarkdownProcessor.cfc, you could then write:

var markdownProcessor = new
plugins.markdown.app.model.MarkdownProcessor();

Does it make sense to have all plugins within the "plugins" mapping
namespace, or would it be better if each plugin had a mapping that
pointed directly at the plugin, like such:

this.mappings["/markdown/"] = "c:\inetpub\wwwroot\plugins\markdown
\";

Part of me likes having the mapping as direct/short/intuitive as
possible. Plus, with the shorter mapping, the plugins don't really
know they're plugins, which is rather nice.

Then again, I also like having everything bundled inside the "plugins"
namespace to not clutter the global mappings.

Thoughts?

Ryan Arneson

unread,
Jun 1, 2011, 3:05:22 PM6/1/11
to col...@googlegroups.com
If you leave it inside the plugins namespace you're not going to run into naming conflicts with mappings created by ColdMVC.

My vote would be leave it in plugins.

Joe

unread,
Jun 1, 2011, 3:09:25 PM6/1/11
to ColdMVC
I agree with Ryan A. Leave it in the plugins. It's so handy.

Tony Nelson

unread,
Jun 1, 2011, 3:10:15 PM6/1/11
to col...@googlegroups.com
It wouldn't be any less handy outside of /plugins.


-Tony

Joe

unread,
Jun 1, 2011, 3:13:34 PM6/1/11
to ColdMVC
I like that it's prefix with /plugins/ that way for some silly reason
if i make a mapping called /markdown/ it doesn't effect the plugins
one. Highly unlikely, but possible. And it also reads to me that it's
a plugin where /markdown/ could be something else.

Ryan Arneson

unread,
Jun 1, 2011, 3:13:39 PM6/1/11
to col...@googlegroups.com
I also like looking at a list of mappings and knowing what's a plugin and what's not.

Tony Nelson

unread,
Jun 1, 2011, 3:23:56 PM6/1/11
to col...@googlegroups.com
Fair enough. Those are some of the reasons why I choose to nest them inside /plugins/ in the first place.

It's nice to know I didn't do something completely stupid.

-Tony
Reply all
Reply to author
Forward
0 new messages