Look up "cassowary" layout algorithm and all of its implementations.
it's awesome for small things (like mobile-style app GUIs), but not usable for full-scale desktop apps (e.g. a DAW).
but that's a question of performance. 'maintainability' would be removing the code that adds the row to the list, which is trivial with cassowary