Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

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.

share|improve this question
6  
In .NET they are completely different things. Property and Attribute –  ChrisF Oct 4 '11 at 21:32
    
Your saying as a .net developer I'd be wise to only call something an attribute if it refers to an actual .NET attribute class.. yeah that makes sense. Thanks, –  Aaron Anodide Oct 4 '11 at 21:34
1  
Entirely depends on context, as @ChrisF commented. –  Oded Oct 4 '11 at 21:34
    
@DavidSchwartz There is no concept of a inter-site duplicate, and the answers on Stack Overflow aren't particularly useful. –  user8 Oct 4 '11 at 22:53
add comment

2 Answers

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.

share|improve this answer
add comment

The definition of Properties and Attributes are context sensitive based on the programming language/markup you're using.

In standard markup languages (XML, HTML, SVG, etc) an attribute is well defined

<xml version="1.0"> <!-- The attribute here is version -->

In other programming languages an Attribute is an object where a property is a stored value

public Attribute FirstName { get; set; } // C# Property which stores and returns an Attribute object :-D
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.