Java Reference
In-Depth Information
but it 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 systems for program design have been proposed,
used, and ultimately found to be wanting. Terms such as flowchart , structure
diagram , and many more names of graphical program representations are today
recognized only by those of the older generation. Today's candidate for a graphical
representation formalism is the Unified Modeling Language ( UML ) . 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.
UML
History of UML
UML developed along with OOP. As the OOP philosophy became more and
more commonly used, different groups worked out their own graphical or other
representations 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 different graphical representation methods to produce a standardized graphical
representation 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 class diagram 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, Square . 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 double giving the length of a side, and two more values of type double giving
the x and y 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 Square , all data is private. A plus sign indicates
a public member. A sharp ( # ) indicates a protected member. A tilde (~) indicates
package access. So, for the class Square , 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).
class diagram
 
Search WWH ::




Custom Search