Skip to content
David Nichols edited this page Jun 12, 2016 · 3 revisions

Qore Naming Conventions

Overview

The naming conventions documented here are recommendations; any valid identifier can be used for the names listed here.

Object Example
functions function_name()
classes ClassName
constants ConstantName
namespaces NamespaceName
methods methodName()
static methods ClassName::staticMethodName()
member memberName

Functions

Function names should be in lower-case with words separated by underscores (_) as follows

sub function_name() {
}

Constants, Classes, and Namespaces

Constant, class, and namespace names should be in CamelCaps, with no underscores; the first letter should be capitalized as follows:

namespace MyNamespace {
    const MyPollInterval = 250ms;
    class MyClass {
        public {
            MyClassConstant = 1;
        }
    }
}

Methods and Class Members

Class method and class member names should also be in camelCaps (without underscores) with the first letter in lower-case; this also includes static members.

class MyClass {
    private {
        int myInt = 0;
        static int lastNumber = 0;

        # the maximum value of some range
        const MaxValue = 200;
    }

    public {
        bool myFlag = False;
    }

    bool myMethod() {
        return myFlag;
    }

    static string myOtherMethod() {
        return "a string";
    }
}