Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-60330

[Policy] Allow better variable names like $snake_case (or possibly $camelCase)

    XMLWordPrintable

Details

    • Improvement
    • Status: Reopened
    • Minor
    • Resolution: Unresolved
    • 3.3.2
    • None
    • Policy
    • MOODLE_33_STABLE

    Description

      I use moodle coding style when developing plugins, but the variable naming section could improve a little. Not allowing any type of word separation (snake_case or camelCase) makes the names hard to read.

      While we should avoid unnecesary long variable names, by far I see variables with names shorter than it should. I will not try to arguee on why variable names should be descriptive enough.

      My suggestion is to adopt $snake_case in the same way as method names. I am not asking to refactor the whole moodle, but allow it for newer code and plugin developers.

      There is no code change needed for that, only a Moodle HQ reflection and opinion on the topic (although we may need to adapt a few of our code checking tools).

      More information: https://docs.moodle.org/dev/Coding_style#Variables

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              roperto Daniel Thee Roperto
              Ankit Agarwal Ankit Agarwal
              David Woloszyn, Huong Nguyen, Jake Dallimore, Michael Hawkins, Stevani Andolo
              Votes:
              3 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated: