Jonathan,
On Fri, 24 Dec 2004 10:43:45 +0100, Jonathan Ernst Jonathan@ernstfamily.ch wrote:
This patch sets variable naming convention that should be used in the appDB code.
Why would we change it. I think it just clutters up the source without adding value. PHP is a variable-type decleration less language. We often just change string in booleans without thinking about it.
And I think I'm just lazy. I don't like typing more characters. What are your argument for it?
Paul
By using superglobals we already achieved to have a better security and a better readability. Now we easily know which vars are comming from outside of the script ("parameters") and which vars are used inside the script (this is only true if we don't copy superglobals in local vars which is bad imo).
This is already a good thing. But now to improve it even more and make it easy to know what a variable contains without having to read the whole code that precedes it we could just tell the developer what it contains by adding these thre letters to variables we use internally. It's very nice to know at the first sight if we are dealing with an array ([]) or an object for example.
As you said we sometimes use integer or string as booleans. As your patches shows imo you also think it's a bad idea as we should use isset or (if it's an integer) logical operators (if($i>2)). Using strings and integers as boolean to know if they contain a value is bad as it can lead to semantical errors (you never know, someday your database could contain an entry whose id is 0 and then your if($id) check will be wrong).
Migrating to superglobals already makes us add some more characters, why don't we add some more for local vars too (but we don't need to rewrite all the code now, it's just something we can keep in mind when rewriting code or writing new code) ?
However if most of you think it just clutters the code and don't help future AppDB hackers to read the code more easily we could just drop this suggestion.
Jonathan
Le vendredi 24 décembre 2004 à 11:11 +0100, Paul van Schayck a écrit :
Jonathan,
On Fri, 24 Dec 2004 10:43:45 +0100, Jonathan Ernst Jonathan@ernstfamily.ch wrote:
This patch sets variable naming convention that should be used in the appDB code.
Why would we change it. I think it just clutters up the source without adding value. PHP is a variable-type decleration less language. We often just change string in booleans without thinking about it.
And I think I'm just lazy. I don't like typing more characters. What are your argument for it?
Paul