Monthly Archives: July 2007

global or $_GLOBAL[] Versus local variables

Did some tests and found out that scripts of type
[code lang=”php”]
$a=5;
function foo(){
global $a;
return $a +5;
}
foo();
[/code] have relatively bad performance ….

try to use something like [code lang=”php”]
$a=5;
function foo($a){
return $a +5;
}
foo($a);
[/code] instead …

XML Nodes Versus XML Attributes

Decided to speak about this as found that many developers are misusing XML nodes and XML attributes.

In my opinion node should be used only in case if it can have attributes. In this case XML
[code]
[Authors]
[Author]
[Name]Paulo[/Name]
[SurName]Coelho[/SurName]
[/Author]
[/Authors]
[/code]

Should be redesigned into XML
[code]
[Authors]
[Author Name=”Paulo” SurName=”Coelho”/]
[/Authors]
[/code]
I faced some XML structures like
[code]
[root][veryveryverylongnodename]1[/veryveryverylongnodenam][/root]
[/code]
I think this is ridiculous …