How do Assistants interact with other parts of the application?
Assistants are free floating modeless windows.
They communicate with the rest of the application by signaling events to it.
The respond to the rest of the application by listening for events signaled by it.
This very simple architecture is flexible and extensible.
Here's some examples of simple even driven interactions:
Example 1 – A classic F4= Prompt style requestAn order entry form is asking the user to input a customer number.
The user indicates that they would like to prompt the customer by pressing a button or an image (eg: a question mark).
The Order Entry form signals a "SelectCustomer" event and may optionally include details of information already input by the user (eg: partial customer name, number etc) as part of the "payload" associated with the event.
The Customer Assistant detects the "SelectCustomer" event and allows the user to search for the required customer. The "payload" associated with the event may be used to speed up or narrow the initial search. When the user locates and selects the required customer the Customer Assistant signals a "CustomerSelected" event and would include the customer number (and maybe their name) as the "payload" associated with the event.
The Order Entry form detects the "CustomerSelected" event and updates the details of the order being input with the selected customer details.
Example 2 – A more advanced non-modal prompt requestAn Order Entry form is currently active.
The Customer Assistant window is also floating around.
The user goes directly to the Customer Assistant window and searches for a customer. When they select it the Customer Assistant signals a CustomerSelected" event and would include the customer number (and maybe their name) as the "payload" associated with the event.
The Order Entry form detects the "CustomerSelected" event and updates the details of the order currently being input with the selected customer details.
In web applications particularly this is a more efficient way to perform prompting because it cuts out the number of interactions with the remote server that are required to complete the interaction.
Example 3 – Multiple Item PromptingEvent driven processing allows multiple item selections.
An Order Entry form is currently active.
The Product Assistant is window also floating around.
The user goes directly to the Product Assistant Window and selects four different products. When they have completed this selection the Product Assistant signals a "ProductsSelected" event. It would include a list of product numbers (and maybe product descriptions) in the payload of the "ProductsSelected" event.
The Order Entry form detects the "ProductsSelected" event and updates the details of the order currently being input with the all the products selected.
Example 4 – Some other uses for AssistantsHere's some ideas for extending the concept of an Assistant …
- An all powerful Assistant. The preceding examples used 3 discrete assistants. There is nothing to stop you designing a single assistant that can handle multiple things. For example, a single assistant could easily be designed to signal "CustomerSelected", "ProductSelected" or "OrderSelected" (with appropriate payloads) depending upon its interaction with the user.
- A "Currency Calculation Assistant" that performs currency calculations and broadcasts "CurrencyCalculationPerformed" events.
- An "Alerts and Messages Assistant" that polls a server application periodically for alerts and messages that are relevant to the current user. When one is detected it switches to a Framework level command to display the details to the user.
- A "Chat and Messages Assistant" that allows the end-user to create and send messages to other application users in a controlled manner. This would probably be linked to the preceding example in some way (or simply an extension of it).
- A "Server" Assistant that allows the end-user to display and manipulate server side things that he/she has initiated (eg: Reports, Output queues, Message Queues, etc).