This is the example of code I wouldn't want to see in high level API: it's fine for low level, but a UI component should be simple to instantiate, without requiring such code. In my opinion, here we're asking to the add-on devs what the SDK as abstraction layer should do.