Difference between property and attribute

documentationterminology

These two words are completely synonymous for me, but I wonder if there's actually a useful semantic difference that I can incorporate into coding/naming conventions/process.

Best Answer

The English words have overlapping meanings but slightly different implications. Property implies something possessed by something else. Attribute suggests something that is an inherent characteristic.

However, because their meanings almost completely overlap, you can substitute one for the other. The exception would be where the terms are jargon, for example in C# where property and attribute have different, much more specific, meanings. In HTML, there is something specifically called a tag attribute and calling it a property would be confusing.

If you're inventing new jargon for a specific context, I would say to prefer whichever sounds more natural. If it's something discrete that something else contains, I'd generally prefer property. If it's something that is an inseparable inherent characteristic of something else (and especially if it's something other things can have as well), I'd generally prefer attribute.