I’m currently working on a plugin and encountered a naming convention that every plugin was formatted like “su_myplugin”. I did the same thing, but now after reading a bit more my feeling was that a good style naming would actually be the first part to be some kind of vendor identifier. This doesn’t seem to be a dealbreaker since these conventions apparently aren’t enforced, but I’d still like to know if there is some kind of recommendation and what it is exactly.
@DanRathbun has written extensively about the best naming and module structure for extensions. It is best to prefix your extension name with a unique identifier (for example, I use SB_) so that your names are less likely to collide with anyone else’s. It’s not a 100% guarantee, but improves the chances.
As far as I understand, the description by @DanRathbun is covering the internal naming, while you, @slbaumgartner are referring about the name of the initial loader script as well as the folder name for all the components, is that correct? So su_myplugin would be a proper name for a plugin done by SketchUp themselves, while I should pick something like me_myplugin, right?
I am also wondering if the extension warehouse has any conventions in this regard. It probably says it somewhere, but what I found so far wasn’t exactly clear.
That is correct, and yes, su_xxxx is generally reserved for Trimble’s own extensions. You can read about the EW naming conventions on their developer page.
There are multiple levels at which names can collide with other people’s extensions: file names, the extension’s registration name, menu items, as well as the Ruby namespaces Dan discusses. You need to pay attention at all levels else sooner or later it is likely you will collide with someone else!
What I always try to promote, is to mimic the internal namespace module nesting qualification, in the external file and folder naming, replacing :: (scope operators) with underscore characters.
So if you have a widget plugin wrapped in modules Dapper::Widget, then it’s folder should be: “Dapper_Widget” and it’s SketchupExtension class registrar script should have the name: “Dapper_Widget.rb”.
Why make it hard on yourself ?
(P.S. - I personally refer to the “loader script”, as the script in the plugin sub-folder, that gets called by the SketchupExtension instance’s load() method. The one in the outer “Plugins” folder that instantiates the SketchupExtension instance, and registers it with SketchUp’s extension manager, is the registrar script.)
WebDialog parameter keynames is another. The keynames are always prepended with “WebDialog_”, but coders should always unique-ify the rest.
Example: “Dapper_Widget_InputPanel”, instead of simply “InputPanel”.
And another is attribute dictionary names. Many of the SketchUp DevTeam’s examples and extensions, do not use any name prefix at all, (Dynamic Components, etc.) … so other developers should always prefix their dictionary names.
Example: “Dapper_Widget_Properties”, instead of simply “Properties”.