Joey's design study
Contents |
Blur (my Honours project)
Project Summary
My Honours project, nicknamed Blur, is a program that provides a global command line interface which mirrors the functionality of the GUI in any application. It uses self-demonstration to encourage users to transition from the GUI to the command line. In other words, whenever the user invokes a command with the GUI, Blur pops up showing the command line text that will perform the equivalent action.
Initial Design
The following UML diagram shows my initial system design, with some details omitted (such as utility classes that wrap the Win32 functionality, and the class hierarchy containing all the different Commands). In this study I will focus mainly on the auto-complete functionality.
Tour of the design
The CommandForm class constitutes the main GUI of Blur. It follows the Singleton pattern with a minor modification: it is not lazily loaded. This is because I need to be able to manually initialise the GUI when the program starts. After that, there can only be one instance of the CommandForm, and it can be accessed by the static CommandForm.Instance property.
The CommandForm contains one control - the AutoCompleteCommandLine. This class contains most of the logic for the auto-complete functionality, and is responsible for drawing the command line prompt, user input, typeahead and other feedback on the form. Whenever the user inputs some text to the command line, it generates a new AutoCompleteResultSet. This is essentially a collection of AutoCompleteEntries, with some custom logic. It needs to be able to order AutoCompleteEntries in order of relevance, by sorting them into three categories: exact matches, where the user's input exactly matches a valid command, prefix matches, where the user's input matches the beginning of a valid command, and substring matches, where the user's input matches some inner substring of the command. Internally, it uses three separate lists to achieve these (res_exact, res_start, and res_include), and each of these lists is sorted in order of the frequency of use.
AutoCompleteEntries, which represent the command suggestions that show up beneath the command line, are internally represented as strings.
Critique
blah blah blah