SAP/openui5-docs

Contradicting guidelines about default aggregation in XML views/ fragments

boghyon opened this issue · 2 comments

In Keep Your Views Short and Simple, there is the suggestion to remove default aggregation tags:

Remove Clutter From Your Views

It's easy to save a few bytes and make your code a lot cleaner:

  • Don't define properties that are set to their default values.
  • Remove unused namespace aliases.
  • Omit the content or items tag for controls that define default aggregations.
  • Use self-closing XML tags for controls that don't define any aggregations.

On the other hand, the Walkthrough Step 11 says the following:

Conventions

  • Do not make implicit use of default aggregations but always declare the aggregation names explicitly in the view. In the example above, the content aggregation could also be omitted as the Panel control declares it as a default, but it makes the view harder to read.

Would be nice if this contradiction could be addressed internally.

I personally agree with the 1st guideline; omitting default aggregation tags not only reduces the file size, it actually improves readability by reducing levels of indentation. Additionally, the 2nd guideline defies the whole purpose of defaultAggregation in control metadata.

OlMue commented

Hi,
this is a good point, we will look into this.
Thanks and best regards,
Oliver

OlMue commented

Hi,
we removed the contradicting section from the Walkthrough step. You were right, this was outdated and is not a best practice.
Thanks again for bringing this to our attention!
Best regards,
Oliver