Namespace style opinions

    Oct 06 2009 | 1:59 am
    I'm currently finishing development on a [pattr] based preset system that will use a family of Max Abstractions and JavaScripts. Once development is complete, I am planning on looking into rewriting the system with some native objects in C.
    I was curious if anyone had any thoughts of how I should handle the namespaces between the Max versions and the C versions. At first I thought I would give them the same names because in my own work, I would be aware of the name conflict and be able to avoid problems due to potential conflicts. Have any of you done developed projects this way? Have any thoughts on how to handle the namespaces between versions?

    • Oct 07 2009 | 10:08 pm
      In terms of using namespace-style organization in Max (not specific to externals in C). I give each project (or library, or large complex object that will be used in more than one project) a prefix. Then, when i'm adding patches or externals, i divide them up into "namespaces" based on what they do (and i generally end up with more than one level of these). Then each new patch or external (or even images and data files) is named starting with it's namespace followed by it's specific name.
      For example, a project of mine called scrlt contains stuff like this:
      scrlt.main.maxpat - main root patch
      scrlt.midi.bcr.maxpat - sub-patch that handles midi interaction with a BCR2000
      scrlt.midi.bcr.node.knob.maxpat - sub-patch that represents a single knob on the BCR2000
      and so on.
      Dealing with situations where i'm re-writing components is a bit less clear. Often, if i know that i'm doing a quick prototype patch and i know that i'm going to end up rewriting it, i'll add a suffix of some sort to the file name. Something like scrlt.bigobject.proto.maxpat. Then i use the normal name, i.e. scrlt.bigobject.mxe for the new version. When i want to switch patches that use the object to the new version, i all of the relevant patches in a text editor, and do a find/replace on the name to remove the suffix (if you're using pre-Max5, save them in the mxt text format).