Java Reference
In-Depth Information
December 17, 2007
Mark Dunit, Analyst
An application is needed to provide the same functionality as the StockTracker
application, yet be accessible via the Web. In addition to allowing users to track
their own customized list of stock holdings, the application must retrieve an online
stock quote for a given stock and display the result at the user's request. Again,
user maintenance functions are allowed only for administrative users.
WebStocks Web Application
Online stock quotes are retrieved from the Yahoo stock ticker service, a CGI
program that returns a comma-delimited list of data for a stock or stocks, with
each list returned on a separate line. The service is accessed at
http://quote.yahoo.com/d/quotes.csv followed by a parameter list of
?symbols=<symbolList>&format=<variables>&ext=.csv;
where <symbolList> is the stock symbol or symbols sent (comma-delimited), and
<variables> is the list of data requested from the service, with no embedded
blanks or commas. The extension must be .csv, for “comma separated values.”
A list of variables that can be passed to the service include:
s = Symbol 19 = Last Trade dl = Date of Last Trade
cl = Change c = Percent Change tl = Time of Last Trade
o = Open Trade h = High Trade x = Name of Stock Exchange
g = Low Trade v = Volume 11 = Price
a = Ask Price b = Bid Price n = Company Name
j = 52-week low k = 52-week high p = Previous Close
FIGURE 12-2
of the source code greatly and complicate its logic. By using HTML or JSP for
the user interfaces, a Web page developer can create the user interface Web pages
while a Java developer builds the servlet, thus allowing specialization of devel-
oper skills and shortening development time. Finally, by accessing a service avail-
able on the Web, significant additional functionality is provided with little
development effort. Relying on a previously existing component to provide a
service, rather than developing the code, is an example of another level of code
reuse to improve productivity.
DESIGN THE SOLUTION Once you have analyzed the problem and
understand the needs, the next step is to design the application in terms of the
MVC pattern discussed earlier. Designing the solution requires you to make
 
Search WWH ::




Custom Search