These seem to mean the same thing. But what term is more appropriate in what context?
<property attribute="attributeValue">proopertyValue</property>
would be one way to look at it.
In C#
[Attribute]
public class Entity
{
private int Property{get; set;};
No difference. Just fashion. But you aren't the first to wonder about this. Google "attribute versus property".
Delphi used properties and they have found their way into .NET (because it has the same architect).
In Delphi they are often used in combination with runtime type information such that the integrated property editor can be used to set the property in designtime.
Properties are not always related to fields. They can be functions that possible have side effects (but of course that is very bad design).
In Python...
class X( object ):
def __init__( self ):
self.attribute
def getAttr( self ):
return self.attribute
def setAttr( self, value ):
self.attribute= value
property_name= property( getAttr, setAttr )
A property is a single attribute-like name that wraps a collection of setter, getter (and deleter) functions.
An attribute is usually a single object within another object.
Having said that, however, Python gives you methods like __getattr__
which allow you extend the definition of "attribute".
Bottom Line - they're almost synonymous. Python makes a technical distinction in how they're implemented.
The precise meaning of these terms is going to depend a lot on what language/system/universe you are talking about.
In HTML/XML, an attribute is the part of a tag with an equals sign and a value, and property doesn't mean anything, for example.
So we need more information about what domain you're discussing.
In Java (or other languages), using Property/Attribute depends on usage:
Property used when value doesn't change very often (usually used at startup or for environment variable)
Attributes is a value (object child) of an Element (object) which can change very often/all the time and be or not persistent