Chapter 9. Coding it Up: The DCI Architecture

Chapter 8 described an architecture for the relatively simple case where activities in the functional requirements correspond closely to member functions on domain classes. In this chapter we describe how the architecture can encapsulate and express functional requirements that come from true use cases: more elaborate sequences of tasks carried out to accomplish some goal in a context.

Sometimes, Smart Objects Just Aren't Enough

At the beginning of Chapter 8 we described the kinds of programming structures well-suited to a Model-View-Controller architecture, such as the common primitive operations of a graphical shapes editor. In operations such as moving or re-coloring a shape, the algorithmic structure is trivial relative to the program data structure. The Controller can catch the menu selection or mouse button push that indicates a certain command given the context where the gesture occurred, and it can directly dispatch a request to the right model (domain) object to handle that request. Clever designers that we are, we will have enhanced the API of the domain object so that it supports such requests in addition to the "dumb data" operations we take for granted in domain objects.

But computers help us do more than just store data; sometimes, they can tackle complex tasks that actually make the computer seem pretty smart. In most of these cases the end user is thinking of some goal they want to attain through a short sequence of tasks. ...

Get Lean Architecture for Agile Software Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.