Java Reference
In-Depth Information
programming language like Java and a natural language like English. To think about a
programming problem without needing to worry about the syntax details of a language
like Java, you can simply relax the syntax rules and write in pseudocode. Pseudocode has
become a standard tool used by programmers, but pseudocode is a linear and algebraic
representation of programming. Computer scientists have long sought to give software
design a graphical representation. To this end, a number of graphical representation sys-
tems for program design have been proposed, used, and ultimately found to be wanting.
Terms like
and many more names of graphical program rep-
resentations are today only recognized by those of the older generation. Today's candidate
for a graphical representation formalism is the
flowchart,
structure diagram,
).
UML was designed to reflect and be used with the OOP philosophy. It is too early to say
whether or not UML will stand the test of time, but it is off to a good start. A number of
companies have adopted the UML formalism to use in their software design projects.
Unified Modeling Language
(or
UML
UML
History of UML
UML developed along with OOP. As the OOP philosophy became more and more
commonly used, different groups developed their own graphical or other representa-
tions for OOP design. In 1996, Grady Booch, Ivar Jacobson, and James Rumbaugh
released an early version of UML. UML was intended to bring together the various dif-
ferent graphical representation methods to produce a standardized graphical representa-
tion language for object-oriented design and documentation. Since that time, UML has
been developed and revised in response to feedback from the OOP community. Today
the UML standard is maintained and certified by the Object Management Group
(OMG), a nonprofit organization that promotes the use of object-oriented techniques.
UML Class Diagrams
Classes are central to OOP and the
is the easiest of the UML graphical
representations to understand and use. Display 12.1 shows the class diagram for a class to
represent a square. The diagram consists of a box divided into three sections. (The colors
are optional and not standardized.) The top section has the class name,
class diagram
class diagram
. The next
section has the data specification for the class. In this example there are three pieces of
data (three instance variables), a value of type
Square
giving the length of a side, and two
double
more values of type
coordinates of the center of the square. The
third section gives the actions (class methods). The notation for method entries is not
identical to that of a Java method heading but it contains the same information. A minus
sign indicates a private member. So, for the class
giving the
x
and
y
double
, all data is private. A plus sign
Square
indicates a public member. A sharp (
) indicates a protected member. A tilde (
) indicates
#
~
package access. So, for the class
, the class diagram shows two public methods and
one protected method. A class diagram need not give a complete description of the class.
When you do not need all the members in a class for the analysis at hand, you do not list
all the members in the class diagram. Missing members are indicated with an ellipsis
(three dots).
Square
Search WWH ::




Custom Search