PyHP_pph icon indicating copy to clipboard operation
PyHP_pph copied to clipboard

Naming convention

Open ghost opened this issue 8 years ago • 4 comments

We should have a naming convention. One idea I've been toying with for a bit is that absolutely everything uses PascalCase (except primitive types and $self, which use camelCase), with a strict prohibition on doing anything to indicate what an identifier refers to.

class SomeThing
  {
    String $ThingInTheThing;
    
    String GetThingInTheThing()
      {
        return $self->$ThingInTheThing;
      }
    
    boolean SetThingInTheThing(String Value)
      {
        $self->$ThingInTheThing = Value;
      }
  }

ghost avatar Jun 22 '17 20:06 ghost

We could limit the length of a variable name to around 3 characters. After all, simplicity is the essence of Python.

Kampfkarren avatar Jun 22 '17 20:06 Kampfkarren

That would break a lot of our example code library.

ghost avatar Jun 22 '17 22:06 ghost

Damn, you're right. It's difficult to force a naming convention for the actual language,if that's what you're proposing.

Kampfkarren avatar Jun 23 '17 02:06 Kampfkarren

Most languages have a naming convention; it's virtually impossible to enforce, but publishing the naming convention and using it in all the example code and standard libraries will cause most programmers to use it.

ghost avatar Jun 23 '17 23:06 ghost