web-profile

naming in programming

Class and Method Naming

Class name should be a noun (User, Post). Method name should be a verb (create, activate).

Class names should always start with an uppercase letter.

class Class_name {

	function get_file_properties() {} // descriptive, underscore separator, and all lowercase letters

}

Variable Names

Variables should contain only lowercase letters, and be reasonably named to indicate their purpose and contents. Very short, non-word variables should only be used as iterators in for() loops.

for ($j = 0; $j < 10; $j++)
$str
$buffer
$group_id
$last_city

Leave a Reply

Your email address will not be published.