Tips_namingconventions   >   Method Names

Method Names

The following are some general guidelines for method names:

Public vs Private Methods

Omnis Studio divides methods into two categories:

The issue of public vs. private methods is very important to the object-oriented programming concept of information hiding, which allows you to write less fragile and easier to maintain code.

Public methods are the access points to an object's information and functionality. Private methods are the internal workings of the object.

You can modify private methods and even change private method names without breaking code in other classes.

Action vs Property Methods

As you get into object-oriented programming you will see two distinct categories of public methods.

Protected Methods

When you are working with a superclass/subclass structure there will come a time when you create a private method in the superclass, but then later when working in the subclass realize you need to access the private superclass method.

The simple solution is to to change the private method to a public method by adding a $ prefix to the superclass method name.

changes to


The problem with this solution is the method that was intended to be private now shows up as a public method in the Interface Manager along with all the other public methods. The clean public interface to the objects now begins to get messing and non-subclass classes could call this once private method.

Some object-oriented programming languages allow you to create protected methods. In the object-oriented world protected methods can only be accessed by subclasses of a superclass. Omnis does not provide a way to create protected methods.

One solution is to prefix protected methods with $_ (e.g. $_actionMethodName) The $_ prefix naming convention communicates to other classes that this method is meant to be accessed by subclasses of the class. The protected methods group separately in lists below the public methods.

Private Submethods

Public and protected methods are able to call private methods within the same class. This makes for a logical flow of method calls.

If you have a very long private method you may want to break it down into several private submethods which the private method calls. The private submethods are not meant to be called by the public or protected methods.

Private submethods are prefixed with the '_' character. If you are writing a public method and need to call private method, using the '_' prefix for a private submethod makes it clear you in to the public method that you should not call that method directly... it belongs to one or more of the private methods.

Method Dividers

For added clarity method dividers are used to separate the property, action, protected, private, and private submethods.

Each method divider consists of 5 dashes, a space, the methods category title, a space, and 5 dashes.

The following is a list of the method dividers used:

Standard Method Prefixes

The following are standard method name prefixes.