There quite are few naming conventions for multiple-word variable names in use these days. The most popular are:
- UpperCamelCase
- lowerCamelCase
- snake_case
There is also kebab-case convention used in LISP.
Moodle has adpoted a non-standard convention - all words are lower-case and glued together (moodlecase) - see Moodle docs. I don’t think there is a name for this convention.
It works quite well in some cases, e.g.
but it’s getting less readable with more words:
to finally become this:
Compare how the above would look like using different conventions:
moodlecase | camelCase | snake_case |
---|---|---|
$isteacher | $isTeacher | $is_teacher |
$launchurl | $launchUrl | $launch_url |
$oauthbodyhash | $oauthBodyHash | $oauth_body_hash |
$truefeedbackimg | $trueFeedbackImg | $true_feedback_img |
$maxcoursesinquery | $maxCoursesInQuery | $max_courses_in_query |
$courseorsystemcontext | $courseOrSystemContext | $course_or_system_context |
$linkedcompetencypercentageformatted | $linkedCompetencyPercentageFormatted | $linked_competency_percentage_formatted |
$proficientusercompetencyplanpercentageformatted | $proficientUserCompetencyPlanPercentageFormatted | $proficient_user_competency_plan_percentage_formatted |