Omnis Technical Note TNID0002

Naming conventions used in Omnis Studio

For Omnis Studio
By Omnis Technical Support

This is a simple guide to the internal naming conventions used in all versions of Omnis Studio and also a guide to how you can use naming conventions in your own applications.

Contents:

Introduction to naming conventions.
Using naming conventions in your own applications.
Internal naming conventions used within Omnis Studio.

Introduction to naming conventions

The simple reason for using naming conventions, is that they make your Omnis applications more understandable by making them easier to read. This helps you when you come to fix bugs and add enhancements, but also helps anyone else who is trying to read your code. When developing Omnis applications as part of a team, then the use of conventions is vital.

Although it's not essential to use a comprehensive naming system in your Omnis application development, we strongly advise that you do. Here we have outlined our recommended naming conventions, which have evolved over time through real Omnis application development experience. We find these conventions work well in all areas of Omnis development.

Using naming conventions in your own applications.

Library Names:

A Library should have a descriptive name followed by the extension ".lbs".

Class Names:

Class names should begin with one or two lower case letters followed by the descriptive name in joined-up capitalized words: do not use spaces, and avoid undescores or dashes, or other potentially confusing symbols, etc. The list below specifies the recommended leading character(s) for each class type followed by an example name.

Class Type Leading Character Example
Code c cUtilityMethods
Menu m mDatabaseTools
Object o oDataAccess
Query q qInvoices
Remote Form js jsMain
Remote Task rt rtMain
Remote menu rm rmNav
Report r rSales
Schema sc scInvoices
Search s sProfit
Table ta taInvoices
Task t tSales
Toolbar tb tbNavigate
Window w wMainEntry

The part following the leading character(s) must also be consistent. We suggest the following simple rules:

1. Classes that edit data should start with "Edit". In case of a window class "wEdit".

2. Classes for navigation of data should start with "Nav". In case of a toolbar class "tbNav".

3. Classes whose only purpose is to be derived from should start with "Super". In case of an object class "oSuperDataAccess".

Variable Names:

Variable and parameter names, with the exception of locals, should start with one or two lower case letters that identify what scope they are. The remainder of the variable name must be descriptive and contain joined-up capitalized words (do not use spaces).

Variable Type Leading Character Example
Task Variable t tEmployeeName
Class Variable c cEmployeeName
Instance Variable i iEmployeeName
Local Variable no letter employeeName
Parameters p pEmployeeName

Variables which are field references or item references should end with "Ref", such as iEmployeeNameRef.

Method and Custom Notation Names:

Public methods must start with a '$' sign. The remainder of the name should be all lower case so it is consistent with the Omnis notation. Private methods must not start with a '$' sign. The actual name should be made up of joined-up capitalized words. For example, "GetInvoiceList".

Column Names:

Column names should follow the local variable naming conventions.

Window/Report Object Names:

The default window/report field/object names assigned by Omnis must always be replaced with an appropriate object name. For window objects that are data-bound, use the data name without the leading characters. For example, if the data name was "iLastName", the object name should be "LastName". For objects that are not data-bound, use an appropriately descriptive name with joined-up capitalized words. For example, "MainOptionsGroup" for a group box.

Internal naming conventions used within Omnis Studio.

Omnis uses several internal naming conventions which it is useful for developers to know about. The main place that you may see these is when Omnis expects a parameter for a function or method. For example, when using a method such as $add() Omnis may expect certain parameters to be used. The Property Manager will help you by telling you the type of parameter that is expected, e.g. create a new library and open the notation inspector (making sure that the property manager is open as well). Navigate to :-

$root.$libs.LIBNAME.$windows

Now look at the Property Manager and you will see the various methods that can be applied to the $windows group. One of the options is $add and you will see in brackets (cName). Once you know that 'c' denotes a character, then you know that $add expects a character as its parameter. Therefore, to add a window called wMainEntry to that group you would use :-

$root.$libs.LIBNAME.$windows.$add('wMainEntry')


The following is a full list of all the parameters used within Omnis Studio:

Variable Type Leading Character Example
Character c cName
Boolean b bSetContents
Item Reference r rItem
Parameter p pOption
Integer i iIdent
List l lList
Binary x xBinaryObject
Date d dDate
Number n nNumber
Object o oObject
Row w wRow
Picture p pPicture
Field Name f fFieldname