Archive

Posts Tagged 'refactoring'

PHP Refactoring - Lez. 1: a class

When we write each of us uses a class 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, 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 ...

PHP Refactoring - Introduction

8 commenti October 29, 2008 Nicholas 8 comments

Refactoring or optimization of existing code.

Too often we as programmers to hand-code dirty, poorly written and full of bugs, with the risk that the elimination of an error chain genres other bugs.

There are two solutions:

  • Take a nice white paper and plan the application from scratch;
  • identify the possibility of dividing the program into independent portions of the code and rewrite it in order to improve it without macros make instant changes.

The first case is the one preferred by the individual, but unfortunately for contingent needs (budget, timelines put online) less viable.

Continue reading ...

Tag: , , , Categories: PHP Tags: , , ,