KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Efficiency in naming Forms, Methods, and Variables
PRODUCT: 4D | VERSION: 13.2 | PLATFORM: Mac & Win
Published On: April 12, 2013

To save coding time it is good to be aware of practices that are perfectly allowable in 4D but carry a time and effort penalty when used.

4D allow numerous coding elements, including Forms, Methods, and Variables to be made of multiple words. For example, [MyTable];"My First Form", "My First Method", and "My First Variable" are all perfectly league names. The issue with these names is the effort it takes during coding to select one of them for copying or deletion.

For example, when using the mouse to select "My First Variable" the most efficient way would be to double-click on one of the outside words and drag across the other two. The same is true for the method and field names.

A more efficient naming convention is to use one of three coding notations, either the PascalCase, camelCase, or Under_score notation.

  • PascalNotation - Every word is capitalized - "MyFirstVariable"

  • camelNotation - The first character is always lower case and each word after that is capitalized - "myFirstVariable"

  • Underscore - an underscore separates each word, capitalization is optional - "My_First_Variable" or "my_First_Variable"

The efficiency in using one of these notations is that a double-click will select the whole word and no dragging is necessary.

To see what coding professionals have to say on the subject and interesting article can be found at PascalCase, camelCase and Underscores and CamelCase vs underscores: Scientific showdown.

Regardless of the notation chosen the amount of mousing to edit code is significantly reduced.