I was thinking about similar thing recently. The UI state should be isomorphic to the state of the application (which is arguably hard to do with the command line, but I digress).<p>So every action that user can take in the UI has clear correspondence in valid change of the application state.<p>Also, this would affect composability. If the state of the application of composed of smaller elements, the UI should be composable too.<p>So just be defining the application state (this perhaps includes edited document in editors), and possible transitions (which is a category), one should get a skeleton of how UI would behave.