Page 1 of 1

variables, properties, data members, etc, why so many names?

Posted: Sat Jan 24, 2009 6:45 pm
by FunkyDude
I was reading on OOP and was curious if anyone could explain the differences as to why there's so many different names for variables?

So far I've seen,

variable (outside of a class)

data member (in a class)
property (in a class)
attributes (in a class)

essentially they're all something that stores data, but what's the differences?

Re: variables, properties, data members, etc, why so many names?

Posted: Sat Jan 24, 2009 11:49 pm
by aschlosberg
The difference between those in and out of a class is that there can be multiple instances of the former as they are specific to a particular instance of the class. The different naming aids in designating the difference between them.

As for the various names for those inside a class I'm not actually sure.

Re: variables, properties, data members, etc, why so many names?

Posted: Sun Jan 25, 2009 6:43 pm
by Chris Corbyn
Member and Property are often used interchangeably but there's a subtle difference. Member can refer to either a property, or a method.

Method and Property clarify what you're referring to. Attributes, yeah, yet another term. I suspect all these terms have arisen from different languages.

PHP tends to call them Properties and Methods. Java does too. C++ often calls them members... blah, it's all messed up :lol:

Re: variables, properties, data members, etc, why so many names?

Posted: Mon Jan 26, 2009 4:59 am
by Jenk
Some of them can be attributed to hotshots wanting to be the one who chose the 'next big name' or just to put their own flavour on it *cough*Microsoft*cough* others are just differences in languages (spoken languages, not syntax) where the literal translation of names can be lost, such as literally translating property from English to another language and back again may come out as member.

Re: variables, properties, data members, etc, why so many names?

Posted: Wed Jan 28, 2009 1:14 am
by josh
In javascript members are properties. In PHP you could store the name of a method as a property ( and use it to reflectively call the property )