Information Technology Reference
In-Depth Information
Fig. 3.2
Truck class
3.2.2 Classes
The previous chapter also saw the introduction of the concept of a class, which we
described as the blueprint used in the creation of an object. Figure 3.2 shows how
this type of abstraction is presented in UML.
Here we see the class that was used to instantiate the monster_truck object in
Fig. 3.1 , the Truck class. As we can see, a class diagram lists the class' name in the
top box, the associated attributes in the middle box, and the operations in the
bottom box. Various symbols are used to denote information about the class itself.
The symbols preceding the class' attributes and methods are used to express the
access levels: a ' + ' symbol is used for denoting a public attribute, ' # ' for one that
is protected, and a ' - ' for one that is private. We also see that each attribute
declaration is made up of two parts separated by a ':' symbol: the first is the
attribute's name; the second is the attribute's type. So, the wheelQty attribute,
for instance, has the type integer, or int . The method representations follow this
same schema, but appear slightly more complicated. Directly following a method's
name, we find a set of parentheses, ' ( ' and ' ) ', sometimes with information
enclosed. The enclosed information describes the arguments that a particular
method is to accept, in the familiar attribute form. If there is no information here,
the method accepts no arguments. The final portion of a method definition, fol-
lowing the ' : ', describes the method's return type. A method defined for return
type void does not return anything. To put this all together, let's look at the tow
method defined in +tow (what : object) : void . This is a public method
which accepts one argument, what , which is an object, and produces no return.
3.2.3 Actors
Unlike objects and classes, which are software entities within a software system,
an actor is an external entity, such as a person or an organization, that interacts
with a software system. More specifically, an actor is the role played by such
entities when interacting with the system. An actor is who or what is responsible
Search WWH ::




Custom Search