Java Reference
In-Depth Information
Implement the interface using a test-driven approach by considering each
request in turn.
3
Let's first look at each one of these steps and then see how they are applied.
Identifying requests
The first step in adding behavior to the domain model is to identify the requests
that the application must process and determine how it responds to them. When
the application receives a request from its client, it must process the request and
send back the appropriate response. For example, in a web application, when a
user performs some action such as filling in a form or making a selection by click-
ing on a link, their browser sends an HTTP request and the application sends back
an HTML page. The presentation tier handles requests by directly or indirectly call-
ing the domain model, which performs the calculations, updates the database, and
retrieves the required data. Consequently, we can determine the interface—types
and methods—that the domain model must expose by analyzing the requests.
We can identify the requests that the application must process by analyzing
either the UI design or the application's use cases or stories. The UI design speci-
fies the user's actions, such as form submissions and mouse clicks, and clearly
specifies the requests that must be processed by the application. Use cases often
define a sequence of requests. For example, consider the Place Order use case
that you first saw in chapter 2:
The customer enters the delivery address and time. The system first verifies that
the delivery time is in the future and that at least one restaurant serves the deliv-
ery information. It then updates the pending order with the delivery informa-
tion, and displays a list of available restaurants.
The customer selects a restaurant. The system updates the pending order with
the restaurant and displays the menu for the selected restaurant.
The customer enters quantities for each menu item. The system updates the
pending order with the quantities and displays the updated pending order.
The customer enters payment information (credit card information and billing
address). The system updates the pending order with the payment information
and displays the pending order with totals, tax, and charges.
The customer confirms that she wants to place the order. The system authorizes
the credit card, creates the order, and displays an order confirmation, which
includes the order number.
 
Search WWH ::




Custom Search