Friday, February 11, 2005

User Process Components and State

I have had some more thoughts on user process components and thought I should try to put it into writing...

If we are to separate more completely the user interface from the processing, there still needs to be some way to share information between the user interface and the process, and visa versa. My current thoughts on this are leading me towards a more specific shared state. Let me explain.

In the current UPC (version 2), the state shared between the controller and the user interface uses a general key-value pair scheme. Both the user interface and the controller must know which keys contain which values, and which keys are manipulated by which user interface screen. This logic is not obvious from the types involved in the transaction, and so must be maintained in project documentation.

In order to further decouple the user interface from the processing, this state contract can be strengthened. Rather than using simple key value pairs, I believe that it will be better to introduce interfaces on the state information. Each of the user interface components (UIC) can then interact with one of these interfaces. The state passed into the UIC would conform to this interface, and the actions of the UIC would then guarantee that certain actions are performed upon the state passed in (view, add, update, etc.).

The User Process Component (UPC) framework would provide a base interface from which the other state interfaces would inherit. This interface would provide access to the key-value pair exposed by the state base class. More detailed interfaces would expose a more fine grain access, allowing access to specific data (possibly read only). Each interface would be designed to represent a single aspect of the state. In this way, multiple interfaces would be used on a single state item. For example you can have a IAddressInformation interface. This would be used to represent data that contains an address, such as a Customer, Order, etc. An Address form can then be created in the UICs, and can be used to manipulate address information for multiple UPC (for example Create Order, ChangeAddress, Register Customer, etc.) . As the actual processing is not within the UIC this will be very flexible.

This should be able to be implemented in the UPC version 2 framework. Something that I will have to look into soon.

Always remember to look on the bright side of life...

No comments: