Custom Function Namespace Experiment

After writing the blog post about funciton scripting, the original author of the technique, Alexander Zueiv, was kind enough to comment on the article. He mentioned the possible problem of script variable name conflicts, and I agree, and eventually I'll edit the technique to include name spaces for the script variable names used by the technique so that isn't an issue.

But that reminded me of another namespace area that I've been experimenting with. Over the years, FileMaker has added organization features to various object types within FileMaker. We can now include spearators and folders for scripts and layouts, and I hope that eventually we'll see similar organization features for fields and custom functions, perhaps even value lists.

But we don't have them yet. With fields I tend to use global number fields to separate fields into groups. With custom functions, I use a different approach, which, for lack of a better term, I'll call namespaces.

I don't actually have a function called AssignParams in my solutions. Instead I have scpm.AssignParams where scpm is short for "script parameters". Other name spaces include devp for developer functions that aren't part of another set, appl for custom functions that are relevant only to the current solutions, or dict for dictionary functions.

I've been doing this for about six months or so with all of my custom functions. Every custom function I use now begins with a four-letter code that specifies it's grouping or namespace. In addition to this, so that the list of custom functions, when sorted alphabetically, is nicely grouped, I have functions that serve only as separators, as in scpm_____ Script Parameters ___________________________________________________. The sorting places this before any custom function that begins with scpm., so it seems to work fairly well.

I'm still unsure of this. Sometimes, for less commonly used functions, I don't remember what the namespace is, but I remember the main name, and it might take me a few more seconds to find it, but so far I think the organization overrides that downside. My custom function library currently has 268 items (including the separators), and I've begun treating these custom functions as built into FileMaker, making one of my first tasks on a new system importing all of them into the new solution. When I write or come across a new custom function, I add it to the library.

I'd be interested in comments on this experiment, as well as other ideas for custom function organization.

Add comment


Security code
Refresh

Search

Products