Menu

Naming Conventions

Myth Web Technologies & Services

Naming Conventions in a nutshell

  • SomeClassName - normal classes are named in capital-first-letter-of-each-word style (Pascal, Camel I think)
  • _SomeClassName - classes that are only for internal implementation purposes are named as usual with an underscore before their name
  • ISomeInterfaceName - interfaces are named like classes with an extra "I" prefix
  • TSomeTraitName - traits are named like classes with an extra "T" prefix
  • $SomeGlobalVariable - global variables (should be only very very few of those) are named like classes, usually using the same name as the class it is created from. No scalar globals allowed, only few few few objects!
  • $someLocalVariable - variables in inner scopes (function code, function/method parameters) are named in a first-word-small-letters-all-others-capitalized-first-letter basis
  • $_somePrivateOrProtectedField - class private and protected fields (whether static or instance) are named the same as local variables with an underscore prefix
  • $SomePublicField - public fields are named basically like classes
  • SomePublicMethod() - same applies to public methods
  • someProtectedOrPrivateMethod() - again, but with no underscores this time

Simple isn't it


Related

Wiki: Home

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.