AiS 34: The Interaction Layer
Thursday, July 26th, 2007The three-tiered application is a ubiquitous pattern for a solid design. The three tiers are:
- User interface
- Business logic
- Data access
The dependency is straight down. The user interface depends upon the business logic. It feeds events from the user back into the business logic. It does not directly access the data. The business logic layer invokes the data access layer in order to read and write raw data from the database and other sources, like web services.
While this pattern successfully sheids the user interface from the raw data, it does not effectively sheild the user from the implementation.
Alan Cooper's book About Face 2.0: Essentials of User Interaction Design describes the difference between the implementation model and the conceptual model. The conceptual model is how the user thinks about the problem, and the implementation model is how the program solves it. The differences between the two cause confusion on the user's part, and bugs on the program's. The user interface's direct dependency upon the business logic means that the implementation of the business logic becomes visible to the user.
Here's my solution
On several occasions, I have had the need to insert a fourth layer into an application. Between the user interface and the business logic, I have added an interaction layer. In this case, the dependency is not straight down: the interaction layer does not completely hide the business logic from the user interface. Instead, the interaction layer is the entry point into the business layer. It fills in the gaps when the conceptual model differs from the implementation model, but it steps out of the way when the two coincide.
- User interface
- Interaction
- Business logic
- Data access
It is difficult to inject this layer after the fact, so I have resolved to put it in place on every application, whether it seems to need it or not. The application might really be what-you-see-is-what-you-get. But just in case you need to see something slightly different, the hook is in place.