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

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

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Reopened
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 3.3.2
    • Fix Version/s: None
    • Component/s: Policy
    • Affected Branches:
      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

              Assignee:
              Unassigned
              Reporter:
              roperto Daniel Thee Roperto
              Peer reviewer:
              Ankit Agarwal
              Participants:
              Component watchers:
              Adrian Greeve, Andrew Nicols, Eloy Lafuente (stronk7), Juan Leyva, Jun Pataleta, Sander Bangma
              Votes:
              3 Vote for this issue
              Watchers:
              6 Start watching this issue

                Dates

                Created:
                Updated: