PDA

View Full Version : Attributes vs Properties (who will win?)



jbailey
February 12th, 2008, 05:40 PM
So I've done both and haven't come to a conclusion. When looking at the xml feed I prefer attributes. However, properties work just fine.

Escape-Artist
February 12th, 2008, 06:04 PM
For my xml what I do is consider each node as an object.
I put the content in the element and if theres any object properties I have them as attributes.

jbailey
February 12th, 2008, 06:14 PM
For my xml what I do is consider each node as an object.
I put the content in the element and if theres any object properties I have them as attributes.

one point for attributes (I should consider this two since I too view it this way, but I'll remain impartial)

theRemix
February 13th, 2008, 05:02 AM
i don't know what the technical (performance) differences are, but i personally save attributes for simple data like name="" id="" count="" etc.
and nodes contain long text or more complicated objects (more nodes with nodes etc.)

Dazzer
February 13th, 2008, 06:37 AM
Semantically speaking, attributes is data related directly to the node value.

However, as I've learnt a couple of times.... use whatever works, and whatever is quickest to work with.

For example, I don't see the point in using attributes at all, if it is simply too difficult to use it effectively (hypothetically speaking). Just like in the DOM model, where you had to traverse nodes and get their attributes recursively. In that case it is easier for me to just use nodes.

So, for me, I say don't obcess about semantics, and just get it to work.

jbailey
February 13th, 2008, 11:19 AM
Semantically speaking, attributes is data related directly to the node value.

However, as I've learnt a couple of times.... use whatever works, and whatever is quickest to work with.

For example, I don't see the point in using attributes at all, if it is simply too difficult to use it effectively (hypothetically speaking). Just like in the DOM model, where you had to traverse nodes and get their attributes recursively. In that case it is easier for me to just use nodes.

So, for me, I say don't obcess about semantics, and just get it to work.


Attributes = 1
Properties = 1
so far a tie!


:) haha yes getting it to work is the way to go indeed. KEEP THEM COMING GANG! I might post this in actionscript.org too

Felixz
February 13th, 2008, 04:26 PM
well attributes are optional for me... for example sneaking some vars, properties on the other hand are handled by DataProvider class just by passing xml in constructor...