← Back to context

Comment by themafia

12 hours ago

The simplest explanation is that attributes were a mistake. They add another layer to the structure and create confusion as to where data is best stored within it.

XML without attributes probably would have seen wide and ready adoption.

I see it as the opposite. Attributes weren’t used enough. The result was unnecessarily nested code.

“Keep things flat” is current good advice in terms of usability. That means favor attributes over children.

  • I agree. A sibling thread showed an example of XML above containing params/param/value/int/ nodes which with attributes could just be <param type=int>.

    I do agree that attributes/data was always a huge contention point on where things should go and caused confusion and bikeshedding.

    I also saw a bit of this in the React/JSX community with decisions like render props, HoC, etc where it took a bit to stabilize on best practices.