Académique Documents
Professionnel Documents
Culture Documents
Mark J. Boyd
University of California
Abstra
t
This paper des
ribes TippyCal
, an airplane weight and balan
e
al-
ulator implemented as a Java applet for use through the internet. The
design uses
lasses and inheritan
e to manage data stru
tures,
onstru
tor
overloading to implement two dierent fun
tions, and a GUI interfa
e to
elegantly manage input and display results. TippyCal
a
epts input from
the user about loading of the airplane and determines if the loaded air-
plane is airworthy. The program
urrently implements a single make and
model, the Cessna 172M, but the base data is easily modied to generate
results for any general aviation airplane.
1 Introdu
tion
Obje
t-oriented programming (OOP) for web based ele
troni
ommer
e appli-
ations is an in
reasingly important area of
omputer s
ien
e [3{5℄. Java (and
its OOP stru
ture) is widely used in e-business, business
ondu
ted through the
internet. Java's popularity in this area is due to its extensive libraries, rapid
Graphi
User Interfa
e (GUI) development, easy network interfa
es, platform
independen
e, and support for internet browser environments.
This paper des
ribes TippyCal
1 , a web-based obje
t-oriented system de-
sign, written as a Java applet. TippyCal
provides weight and balan
e informa-
tion about a general aviation airplane, given information from the user about
how the airplane is loaded. This ve week proje
t required an understanding of
the fundamental problem of airplane loading, as well as OOP design and testing
to ensure
orre
t implementation.
1 http://www.
se.u
s
.edu/~mjboyd/java/wb/index.html
1
Se
tion 2 reviews ne
essary denitions. Se
tion 3 presents an outline of
TippyCal
and its signi
ant
omponents, and Se
tion 4 presents an analysis
of the system design. Se
tion 5 presents test results, Se
tion 6 dis
usses future
extensions, and Se
tion 7
on
ludes the paper.
2 Denitions
2.1 OOP
Java is an obje
t-oriented language without all of the
omplexity of C++. Fea-
tures like strong typing, ex
ellent
ompiler error
he
king, platform indepen-
den
e, and automati
garbage
olle
tion support rapid appli
ation development
[2, 6℄. One disadvantage of Java, in general, is an order of magnitude slower
ode exe
ution.
2.3 Applet
A small appli
ation, usually downloaded from a web page link, whi
h exe
utes on
the
lient
omputer. Applets s
ale well be
ause they use distributed exe
ution,
rather than sharing time exe
uting operations on a
entralized server.
3 TippyCal
Design
The ar
hite
ture of the system is a three-tier design, originally proposed by
Tsi
hiritzis and Klug [7℄. The three tiers are: (1) the user interfa
e (UI)
om-
muni
ating with (2) a
al
ualtion program whi
h
ommuni
ates with (3) the
databases and data sour
es. The advantage of this design is that it frees the
UI to
on
entrate on the user rather than the physi
al lo
ation and stru
ture of
the data. Thus we
an later
hange appli
ations or database stru
ture without
2
WBcalcApplet LoadedPlane EmptyPlane
1
TransferFocus
actionPerformed()
breaking other parts of the design or existing appli
ations. Figure 1 shows the
design pattern.
The UI tier
ontains a TippyCal
GUI and a TransferFo
us
lass (subse
tion
3.1). The GUI is implemented as a web page whi
h
ontains a Java applet. The
Java applet handles the user interfa
e for user input and display of the results.
Any
hanges made by the user are kept in the elds for the next
al
ulation.
The design of the
al
ulation tier and LoadedPlane
lass (subse
tion 3.2)
was adapted from a design pattern by Martin Fowler [3℄. This tier presents a
simplied interfa
e to the UI tier.
The database tier
onsists of the EmptyPlane obje
t (subse
tion 3.3). The
obje
t
ontains data about an unloaded airplane's
hara
teristi
s. The obje
t
urrently uses default data for a Cessna 172M, but the use of
onstru
tor over-
loading allows this obje
t to be lled with data from a database of dierent
types of airplanes.
3.1 GUI
The GUI (Graphi
al User Interfa
e) for the portfolio manager is implemented
in the WB
al
Applet
lass. This
lass a
epts data from the user and presents
results.
The WB
al
Applet
lass extends Applet, thus inheriting all of the fun
tion-
ality of the Applet
lass. WB
al
Applet also implements A
tionListener, whi
h
WB
al
Applet uses in addition to the TransferFo
us
lass to respond to GUI
events to update the s
reen. In this manner, the GUI uses the advantages of
inheritan
e and en
apsulation espoused in OOP and OOD. The Button
lass
3
was developed with the Model-View-Controller design pattern in mind and as
a result the WB
al
Applet
lass implements this design pattern [4℄.
The TransferFo
us
lass neatly manages the transfer of attention from one
input eld to the other. This
lass is
arefully designed to naturally
ow through
the elds most likely to have modied data, while ignoring the data elds least
likely to be
hanged. The empty moment and empty weight elds
an be
hanged, but these are never brought to fo
us automati
ally, sin
e they are
least likely to
hange.
This
lass unites the input from the user with the EmptyPlane data to determine
the airworthiness of the loaded airplane, or to determine the maximum amount
of fuel able to be loaded. Table 1 shows that this
lass does a re
al
ulation ea
h
time the input is
hanged.
3.3 EmptyPlane Class
This
lass has the base data for a parti
ular type of empty airplane. For any
plane of the same type, the empty weight and moment may be dierent (as
semi-permanent removals of avioni
s or a
essories may
ause some
hanges),
but the ee
ts of loading the seats or fuel remain standard. The
onstru
tor
may easily be overloaded to allow passing of these parameters from a database
or
ookie.
4 Design De
isions
Several important de
isions ae
ted the design.
4.1 Applet vs. Servlet
Table 2 shows the development time for the proje
t. One reason for implement-
ing an applet was to avoid unreliable server performan
e and
omplex imple-
4
mentation. As implemented, the applet exe
utes instantaneously when values
are
hanged, requiring no intera
tion with the server. One drawba
k was the
test error found on some browsers whi
h does not
orre
tly release memory ba
k
to the
lient
omputer when the program terminates.
4.2 Grid GUI
The grid layout was used to produ
e a
olumn of results, rather than any more
sophisti
ated GUI. This works well to produ
e a simple-to-understand GUI
whi
h is less sus
eptible to errati
hanges when the browser window size is
altered.
4.3 Default Data
Default data is initiated in the input elds to redu
e the data entry required by
the user. The program assumes the plane is fairly heavily loaded sin
e a user
wouldn't be using the program generally to solve easy problems with minimal
loading. The program
an be improved by saving the last entered data in a
ookie and keeping it as the default data for the next time the program is
started.
6 Future Work
The system
an be improved by adding a database for dierent air
raft whi
h
an be sele
ted by the user. Another improvement would be to keep the empty
plane moment and weight data, as well as default loading data, in a
ookie so
that the program uses this data for future problems when the
orresponding tail
number is entered.
5
Task WB
al
Applet TransferFo
us LoadedPlane EmptyPlane
design 8 2 8 2
ode/test 5 1 8 4
integrate 1 1 1 1
report 3 1 2 1
present 1 1 1 1
totals 18 6 20 9
7 Con
lusion
TippyCal
implements a web-based airplane weight and balan
e
al
ulator for
general aviation airplanes. Sin
e it is an obje
t-oriented Java design, it uses fea-
tures of inheritan
e and overloading to minimize development time. The design
is easily extensible to use
hara
teristi
s of other airplanes, mainly due to the
logi
al obje
t-oriented nature of the problem. TippyCal
is a very good demon-
stration of the benets of Java and OOP applied to web-based appli
ations.
Referen
es
[1℄ Timothy Budd. An Introdu
tion to Obje
t Oriented Programming (2nd Edition). Addison
Wesley, Reading, MA, 1997.
[2℄ David Flanagan. Java in a Nutshell (2nd Ed.). O'Reilly and Asso
iates, In
., 101 Morris
Street, Sebastapol, CA 95472, USA, 1997.
[3℄ Martin Fowler. Analysis Patterns: Reusable Obje
t Models. Addison Wesley, Reading,
MA, 1997.
[4℄ Cay S. Horstmann and Gary Cornell. Core Java 2. Prenti
e-Hall, Upper Saddle River,
NJ, 1999.
[5℄ Cary A. Jardin. Java Ele
troni
Commer
e Sour
ebook : All the Software and Expert
Advi
e You Need to Open Your Own Virtual Store. John Wiley and Sons, New York, NY,
1997.
[6℄ Ira Pohl and Charlie M
Dowell. Java by Disse
tion: The Essentials of Java Programming.
Addison Wesley, Reading, MA, 2000.
[7℄ Dennis Tis
hritzis and Anthony Klug. The ANSI/X3/SPARC DBMS framework report
of the study group on database management. In Information Systems, number 3, pages
173{191, 1979.
[8℄ C. Thomas Wu. An Introdu
tion to Obje
t Oriented Programming With Java. M
Graw-
Hill College Division, New York, NY, 1998.