Archive

Archive for the 'Refactoring'

PHP Refactoring - Lez. 1: properties of a class

When we write a class we each use of its conventions.

I recommend using the following properties of a class:

  • If consists of a single word, all lowercase, for example $ name;
  • If made ​​of many words the first letter of each, starting from the second, in uppercase, all lowercase other, for example $ nomeAziendaItaliana;
  • If a constant is composed of single-word write in all caps, for example ELEMENTS;
  • If we have a constant composed of several words to write in all caps with a hyphen between the words, for example ELEMENTI_PER_RIGA
  • The variable name must be self-explanatory

Continue reading ...