《The Object-Oriented Thought Process》读书笔记7

10 Creating Object Models with UML

What Is UML?

Unified Modeling Language.

The Structure of a Class Diagram

《The Object-Oriented Thought Process》读书笔记7

Figure 10.1 A UML diagram of the Cabbie class.

Attributes and Methods

    Attributes

all attributesshould be declared as private.

    Methods

Including toomuch information (like parameters) in the class diagrams makes the object-modeldifficult to read. This is one of those issues that depends on your specifictastes.

    AccessDesignations

In Java, thedefault type of access is protected. Protected access means that only classesin the package can access the attribute or method.? 说法有错误。

Inheritance

Multiple inheritance: Eiffel and C++

Interfaces

Composition

Aggregation

An aggregation is representedby a line with a diamond at the head.

Association

In UML notation,a plain line represents this service, with no shape on either end.

Note thatbecause there is no shape on either end of the line, there is no indication aboutwhich way the service flows. The figure shows only that there is an associationbetween the two classes.

Cardinality

 

Conclusion

You do not needUML to design OO systems, but UML is a tool that can be used to assist in thedevelopment of OO systems.