Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Difference between property and attribute ?

 
ram kumar
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi pals,

I went on thru tiles with struts, there is something called as property and some thing called as attributes !

Could some one explain me just the

#general meaning of Attribute and Property - using the same example for both !

#More specific meaning of Attribute and Property in terms of a java class - using a same example for both !


I need your ideas and suggestions on when to call some thing as an attribute and some thing as property !

Please help me find a resolution on this !

 
Abhinav Srivastava
Ranch Hand
Posts: 354
Eclipse IDE Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't think there is any "universally" accepted definition of these terms. However, a property "in general" is accessible via JavaBean conventions. i.e. a property "name" would mean getName() and setName() are available and vice-versa. You still have two more amibguous terms Attributes and Fields.
Here is an opinion on this subject, but again, its just an opinion.
link
 
ram kumar
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Abhinav Srivastava:
I don't think there is any "universally" accepted definition of these terms. However, a property "in general" is accessible via JavaBean conventions. i.e. a property "name" would mean getName() and setName() are available and vice-versa. You still have two more amibguous terms Attributes and Fields.
Here is an opinion on this subject, but again, its just an opinion.
link



Yes ! Read that already ! Any how cool , let me take a property to be a property and an attribute to be an attribute.


For My understanding i would just say an attribute is extensible

in an xml file

taking the example of

xml file - attribute
.properties file - property



is a possible notion of saying coke is a drink type from coca cola company limited.

"coca-cola" -super tag
"coke" sub tag of coca cola.

while the same is not possible with a property file.(.properties file)

While the getters and setters are possible in both cases.

we have some thing called as request.setAttribute() in servlet tech. :roll:

Hope ! this would do better ! if there is no proper notion of understanding for these terms.
 
Stephen Davies
Ranch Hand
Posts: 352
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Without getting too worried about the definitions, I would say that a property (of a class) is as stated above, a variable or primitive type declared in the class, where as an attribute is anything associated with that class be it a variable or method, so it perhaps is possible to suggest a property is an attribute?

Just a stab
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic