Java Reference
In-Depth Information
systems, and high-volume stock tickers are similar, because the ratio of reads
to writes is very high.
For this and the more advanced topics in this topic, we'll need a more
robust application. We'll revise our example from chapter 4 to make a primi-
tive message board. The style and structure is taken from the combination of
two different consulting engagements. (They volunteered source code on the
condition of anonymity.) I have already applied our Triangle design pattern.
Our message board will have a variety of discussion topics called boards .
Each board will have threads , which are top-level discussions of the topics
around a central theme. These threads will have a series of attached messages
called replies . Both threads and replies are called posts , and they are stored in
the same database table. Chapter 8 explains how to refactor this solution to
form a persistent object model for this application.
BBS requirements
To build this application, we'll need the following enhancements:
Display a list of top-level posts for our bulletin board. The subjects should
be displayed as links so that when they are clicked, the replies to the post
can be viewed. This list should include a link that can be used to post
another main thread.
Display a full thread . The thread should consist of a top-level post and
all of the replies to the post.
Display a form to add a post . The same form can be used to add both
kinds of posts: top-level threads and low-level posts.
We'll provide the entire example to allow you to keep all of the code at your
fingertips, and to serve as a refactoring foundation for the other examples in
this topic. If you'd like to skip ahead, see the section “Performance Prob-
lems,” later in this chapter.
Building the model, view, and controller for ShowBoard
We'll have a triangle pattern for a board, thread, and post. ShowBoard is the
prefix that we'll put in front of the controller, command, and JSP for the
triangle that shows the contents of a message board. Where possible, we'll
show only the refactored changes between the solution in chapter 4 and our
new solution.
Search WWH ::

Custom Search