Separate Sequencer From Application

This is an instance of SeparateIoFromCalculation.

What is the sequencer? It's the thing that sequences objects so they can be operated on, one at a time, by some kind of application such as a movie player. By all rights, the sequencer should be an operating system function, a utility shared by all applications, but due to widespread incompetence nobody seems to have proposed making it so.

The sequencer doesn't have many features. It takes a possibly cyclic directed graph and some set of applications as input. It recurses through the graph until it gets to leaf nodes, which it feeds one by one into the appropriate application. The order of objects in the sequence is determined by the sequencer. A sequencer can feed objects at random, possibly even rewriting the sequence, just as easily as it can feed objects in alphabetic or other order.

The best way to implement the sequencer is as an ObjectBrowser's registered presenter for objects of type .sequence. When called upon to display a sequence, the sequence presenter (the sequencer) calls upon the default presenter for the first object in the sequence, then the default presenter for the second object in the sequence, and so on. Recursion comes free, the default presenter for a sequence being the sequencer.

The best way to implement the randomizer is as a completely different presenter from the sequencer. It just happens to operate on objects of the same type, type .sequence. Rather than having one module with a random "mode", it follows that we must have two modules and that the user chooses between these modules (presenters) using the same mechanism which they use to switch presenters in general. (Sane systems have dynamic typing.)

What's the point of all this? The point is to take out some very common functionality away from a host of very different applications (eg, music player, movie player, picture viewer, et cetera) so that this functionality can be implemented correctly OnceAndOnlyOnce.

Another important reason to separate the sequencer from the presenter is to allow sequences of heterogeneous object types. So you can seamlessly sequence movies and pictures; the movies playing and the pictures waiting until you press the Next key on the keyboard.

-- RichardKulisz

CategoryInteractionDesign CategoryUserInterface


EditText of this page (last edited March 29, 2006) or FindPage with title or text search