Class names should always start with an uppercase letter. Multiple words should be separated with an underscore, and not CamelCased. All other class methods should be entirely lowercased and named to clearly indicate their function, preferably including a verb. Try to avoid overly long and verbose names.
INCORRECT:
class superclass
class SuperClass
CORRECT:
class Super_class
class
Super_class {
function __construct()
{ }
}
Examples of improper and proper method naming:INCORRECT:
function fileproperties() // not descriptive and needs underscore separator function fileProperties() // not descriptive and uses CamelCase function getfileproperties() // Better! But still missing underscore separator function getFileProperties() // uses CamelCase function get_the_file_properties_from_the_file() // wordy
CORRECT:
function get_file_properties() // descriptive, underscore separator, and all lowercase letters
No comments:
Post a Comment