Tom Muck's Blog
News and Views
Macromedia variable and function names
Monday, June 20, 2005 6:34:56 PM
I got an interesting support question today: it was about the use of variable names in my extensions. The user was saying that there was a name conflict because he was using the name MM_rs in his code and it conflicted with a variable that Dreamweaver was using (via the Recordset Navigation Suite). It occured to me that it might not be clear why certain variables are named as they are.
Macromedia uses the naming convention MM_ at the front of their variables and functions. This is a naming convention that is supposed to reduce support problems because it is a name that a typical user would not use. Since Macromedia's code is built for distribution and may be used by many different users, variable name conflicts could easily occur. In other words, if Macromedia named a variable temp, it might conflict with a variable that a user sets up named temp. However, MM_temp is not likely to conflict with a user's variable name. However, this user wanted to keep his names consistent and decided to prefix everything with MM_.
As far as I know, this is not really documented anywhere, however, and is just "common knowledge" among programmers who use Dreamweaver. Similarly, I typically prefix my variables with tfm_ so that they won't conflict. Massimo uses tmt_, and other programmers use other typical prefixes. It is usually not something I do in my own code, but if I think I'm going to distribute code in an extension or as a code snippet, I use the prefix.
Category tags: Macromedia/Adobe, Dreamweaver, ColdFusion
Posted by Tom Muck
Add comment | View comments (0) | Permalink | Trackbacks (0) | Digg This
Before posting comments or trackbacks, please read the posting policy.