ch01.html

来自「java2高级编程」· HTML 代码 · 共 331 行 · 第 1/2 页

HTML
331
字号
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"><HTML><HEAD><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1"><META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css"><META NAME="GENERATOR" CONTENT="Adobe FrameMaker 6.0/HTML Export Filter"><LINK REL="STYLESHEET" HREF="CH01.css" CHARSET="ISO-8859-1" TYPE="text/css"><TITLE> Covered in This Chapter</TITLE></HEAD><BODY BGCOLOR="#ffffff"><P CLASS="CT"><A NAME="pgfId-1087399"></A>1</P><P CLASS="CT"><A NAME="pgfId-1087400"></A>Matching Project Requirements with Technology</P><P CLASS="Body"><A NAME="pgfId-1087401"></A>One challenge in writing a book on advanced application development for the Java&#153; platform is to find a project small enough to write about, while at the same time, complex enough to warrant advanced programming techniques. The project presented in this book is a Web-based auction house. The application is initially written for the Enterprise JavaBeans&#153; platform. Later chapters expand the core example by adding advanced functionality, improvements, and alternative solutions to do some of the things you get for free when you use the Enterprise JavaBeans platform. </P><P CLASS="Body"><A NAME="pgfId-1087402"></A>To keep the discussion simple, the example application has only a basic set of transactions for posting and bidding on auction items. However, the application scales to handle multiple users, provides a three-tiered transaction-based environment, controls security, and integrates legacy-based systems. </P><P CLASS="Body"><A NAME="pgfId-1087403"></A>This chapter covers how to determine project requirements and model the important steps that should always come before coding begins. </P><DIV><H4 CLASS="A"><A NAME="pgfId-1087404"></A>Covered in This Chapter</H4><UL><LI CLASS="BL"><A NAME="pgfId-1087405"></A>Project Requirements (page 2)</LI><LI CLASS="BL"><A NAME="pgfId-1087406"></A>Choosing the Software (page 5)</LI><LI CLASS="BL"><A NAME="pgfId-1087407"></A>Duke's Auction Demonstration (page 7)</LI></UL></DIV><DIV><H4 CLASS="A"><A NAME="pgfId-1087409"></A><A NAME="26396"></A>Project Requirements</H4><P CLASS="Body"><A NAME="pgfId-1087412"></A><A NAME="marker-1087410"></A>The first step in determining <A NAME="marker-1087411"></A>project requirements is to interview the user base to find out what is wanted in an online auction. This is an important step, and one that cannot be overrated, because a solid base of user-oriented information helps you define your key application capabilities. </P><P CLASS="Body"><A NAME="pgfId-1087413"></A>Chapter 2, Auction House Application, (page 11) walks through the application code, explains how the Enterprise JavaBeans platform works, and tells you how to run a live demonstration. If you have never seen or used an online auction, Duke's Auction Demonstration (page 7) shows mock-ups of the <EM CLASS="A">example auction application</EM> <EM CLASS="CODE">HTML</EM> pages. </P><DIV><H5 CLASS="B"><A NAME="pgfId-1087414"></A>Interview User Base</H5><P CLASS="Body"><A NAME="pgfId-1087415"></A>For the sake of discussion and to keep things simple, this section assumes interviews with the user base found the following auction house and user requirements.</P></DIV><DIV><H5 CLASS="B"><A NAME="pgfId-1087416"></A>Auction House Requirements </H5><UL><LI CLASS="BL"><A NAME="pgfId-1087418"></A><A NAME="marker-1087417"></A>Obtain buyer and seller information </LI><LI CLASS="BL"><A NAME="pgfId-1087419"></A>Bill sellers for posting item</LI><LI CLASS="BL"><A NAME="pgfId-1087420"></A>Record and report the day's transactions</LI></UL></DIV><DIV><H5 CLASS="B"><A NAME="pgfId-1087421"></A>User Requirements </H5><UL><LI CLASS="BL"><A NAME="pgfId-1087422"></A>Bid on or sell an item</LI><LI CLASS="BL"><A NAME="pgfId-1087423"></A>Search or view items for sale</LI><LI CLASS="BL"><A NAME="pgfId-1087424"></A>Notify buyer and seller of sale</LI></UL></DIV><DIV><H5 CLASS="B"><A NAME="pgfId-1087425"></A>Model the Project</H5><P CLASS="Body"><A NAME="pgfId-1087428"></A><A NAME="marker-1087426"></A>After analyzing the requirements, you can build a <A NAME="marker-1087427"></A>use case diagram to gain a better understanding of the elements needed in the application and how they interact. A use case diagram shows the relationships among actors and use cases within the system. A use case is a unique function in a system, and an <A NAME="marker-1087429"></A>actor is the person or software that performs the action or use case. For example, a buyer is the actor that performs the function (use case) of bidding on an auction item, and the seller is the actor that performs the use case of posting an item for auction. Not all actors are people, though. For example, the software is the actor that determines when an item has closed, finds the highest bidder, and notifies the buyer and seller of a sale. </P><P CLASS="Body"><A NAME="pgfId-1087431"></A>The <EM CLASS="A">Unified Modeling Language (UML) (</EM><A NAME="marker-1087430"></A><EM CLASS="URL-Footnote">http://www.rational.com/uml/resources/documentation/notation/notation52.jtmpl</EM><EM CLASS="A">)</EM> is the tool of choice for creating use case diagrams. The use case diagram in Figure 1.1 uses UML to describe the buyer and seller use cases for the online auction application. In UML, squares group the systems, stick figures represent actors, ovals denote use cases, and lines show how actors use the system. </P><DIV><H6 CLASS="FC"><A NAME="pgfId-1087436"></A>Figure 1.1 <A NAME="38342"></A>Use case diagram for an auction house</H6><DIV><IMG SRC="CH01-1.gif"></DIV><P CLASS="Body"><A NAME="pgfId-1087438"></A><A NAME="marker-1087437"></A>The following descriptions further define the project. These descriptions are not part of UML, but are a helpful tool in project definition.</P><P CLASS="Body"><A NAME="pgfId-1087439"></A><EM CLASS="Bold">House Identifies Buyers and Sellers. </EM>An auction application is used by buyers and sellers. A buyer needs to know who the seller is to pay him or her, and the seller needs to know who the buyers are to answer product questions and to finalize the sale. So, to post or bid on an auction item, buyers and sellers are required to register. Registration needs to get the following information from buyers and sellers: </P><UL><LI CLASS="BL"><A NAME="pgfId-1087440"></A>User ID and password for buying and selling</LI><LI CLASS="BL"><A NAME="pgfId-1087441"></A>E-mail address, so highest bidder and seller can communicate when item closes</LI><LI CLASS="BL"><A NAME="pgfId-1087442"></A>Credit card information, so auction can charge sellers for listing their items</LI></UL><P CLASS="Body"><A NAME="pgfId-1087443"></A>Once registered, a user can post or bid on an item for sale. </P><P CLASS="Body"><A NAME="pgfId-1087444"></A><EM CLASS="Bold">House Determines Highest Bidder. </EM>Nightly, the auction application queries the database to record and report the day's transactions. The application finds items that have closed and then determines the highest bidder.</P><P CLASS="Body"><A NAME="pgfId-1087445"></A><EM CLASS="Bold">House Notifies Buyers and Sellers. </EM>The auction application uses e-mail to notify the highest bidder and seller of the sale and to debit the seller's account.</P><P CLASS="Body"><A NAME="pgfId-1087446"></A><EM CLASS="Bold">Anyone Searches for an Item.  </EM>Sellers and buyers enter a search string to locate all auction items in the database.</P><P CLASS="Body"><A NAME="pgfId-1087447"></A><EM CLASS="Bold">Anyone Views Items for Sale. </EM>To popularize the auction and encourage new buyers and sellers, the application allows anyone to view auction items without requiring user ID and password identification. To keep things simple, the auction allows anyone to view summarized lists of items in the following three ways: </P><UL><LI CLASS="BL"><A NAME="pgfId-1087448"></A>All items up for auction</LI><LI CLASS="BL"><A NAME="pgfId-1087449"></A>New items listed today</LI><LI CLASS="BL"><A NAME="pgfId-1087450"></A>Items due to close today</LI></UL><P CLASS="Body"><A NAME="pgfId-1087451"></A><EM CLASS="Bold">Anyone Views Item Details. </EM>The summarized lists of auction items should link each item to the following detailed information. Detail information on auction items is available to anyone without identification. </P><UL><LI CLASS="BL"><A NAME="pgfId-1087452"></A>Item summary</LI><LI CLASS="BL"><A NAME="pgfId-1087453"></A>Auction item number</LI><LI CLASS="BL"><A NAME="pgfId-1087454"></A>Current price</LI><LI CLASS="BL"><A NAME="pgfId-1087455"></A>Number of bids</LI><LI CLASS="BL"><A NAME="pgfId-1087456"></A>Date posted for auction</LI><LI CLASS="BL"><A NAME="pgfId-1087457"></A>Date item closes</LI><LI CLASS="BL"><A NAME="pgfId-1087458"></A>Seller ID</LI><LI CLASS="BL"><A NAME="pgfId-1087459"></A>Highest bid</LI><LI CLASS="BL"><A NAME="pgfId-1087460"></A>Item description</LI></UL><P CLASS="Body"><A NAME="pgfId-1087461"></A><EM CLASS="Bold">Seller Posts Items for Sale. </EM>To post an item for sale, a seller needs to identify himself or herself and describe the item for sale, as follows: </P><UL><LI CLASS="BL"><A NAME="pgfId-1087462"></A>User ID and password for seller identification</LI><LI CLASS="BL"><A NAME="pgfId-1087463"></A>Summary description of item</LI><LI CLASS="BL"><A NAME="pgfId-1087464"></A>Starting price for bidding</LI>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?