Experimental project

This is a sandbox project, which contains experimental code for developer use only.

The module aims to solve a conflicting notion of ordering in the configuration files: Implicit Ordering (by config item key) vs. Explicit Ordering (by config item weight).

Implicit Ordering (by key):
- The associative array is stored in the YAML file with its elements ordered alphabetically by key.
- This ordering is implicit, as it's determined by the YAML formatting.

Explicit Ordering (by weight):
- Each element has a weight property that defines its true ordering during program execution.
- This ordering is explicit, as it's intentionally defined by the application logic.

Great example of this is filter formats, which when saved into a config files, are ordered by key, while also having weight values. This doesn't present itself as an issue until configurations from different code branches have to be merged, or code changes have to be inspected. With the dual ordering system in place - it is hard to tell how the ordering has changed just by inspecting diffs. It is also becomes confusing when not only ordering but the configs themselves have changed.

The conflict arises because:
1. Dual ordering mechanisms: Two separate ordering systems coexist, leading to confusion.
2. Inconsistent sorting: The ordering of elements in the YAML file (by key) may not match the intended ordering during execution (by weight).
3. Maintenance challenges: Updates to the array may require manual reordering in the YAML file to maintain the implicit key-based ordering, while also ensuring the explicit weight-based ordering remains correct.

Proposed solution
The proposed solution here is to use binary tree for capturing the explicit ordering of the configuration items. The benefits are:
- no more dealing with numeric weights which change unpredictably,
- only items which explicitly changed their positions will have their config updated,
- binary tree can be used to represent ordered trees (e.g. fields and field groups) - eventually the same

Supporting organizations: 

Project information