Saturday, 17 August 2013

Do variable identifiers make it easier to read code?

Do variable identifiers make it easier to read code?

In most programming languages variables do not have identifiers like they
do in PHP. In PHP you must prefix a variable with the $ character.
Example;
var $foo = "something";
echo $foo;
I'm developing a new scripting language for a business application, and my
target users do not have a programming background. Do variable identifiers
make code easier to read and use?
One reason PHP uses the $ is because without it PHP can't tell if a name
is a function reference or variable reference. This is because the
language allows strange references to functions. So the $ symbol helps the
parser separate the namespace.
I don't have this problem in my parser. So my question is purely on
readability and ease of use. I have coded for so many years in PHP that
when I see $foo it's easy for me to identify this as a variable. Am I just
giving a bias preference to this identifier?

No comments:

Post a Comment