Java Reference
In-Depth Information
Each paragraph of the use case consists of two parts. The first part describes the
user performing an action such as entering values or making a selection and cor-
responds to an HTTP request in a web-based application. The Place Order use
case implies that the application has to process the following requests:
Enter delivery info —The customer enters the delivery information.
Select restaurant —The customer selects a restaurant.
Update quantities —The customer enters quantities of menu items.
Check out —The customer indicates that they are done entering quantities.
Enter payment information —The customer enters the payment information.
Place order —The customer confirms that they want to place the order.
The second part of each paragraph in the use case describes the application's
response to the request. The application response can be described by a set of
responsibilities. For example, the application processes the enter delivery info
request by:
Verifying that the delivery time is in the future and that at least one restau-
rant serves the delivery information
Updating the pending order with the delivery information
Displaying a list of available restaurants.
The application's responsibilities fall into two main categories. The first kind of
responsibility is one that verifies or validates user input, calculates values, and
updates the database. Typically either services or entities must define methods to
fulfill these responsibilities. The second kind of responsibility is one that displays
values. Although the presentation tier is responsible for displaying data, the
domain model is responsible for providing the data. Typically, either entities or
repositories must define methods that return the required data. Each responsibil-
ity corresponds to one or more domain model methods, and so the first step in
implementing a responsibility is to define the methods and assign them to classes.
Identifying methods
Once we have determined the requests and how the application responds to each
one, the next step is to determine what methods the domain model classes must
provide in order to make this possible. As we saw in figure 3.1, when the applica-
tion handles a request, the domain model's client—a façade or presentation
tier—makes one or more calls to the domain model to validate the request, per-
form calculations, and update the database. It also calls the domain model to get
 
 
 
 
 
 
Search WWH ::




Custom Search