《The Object-Oriented Thought Process》讀書筆記7

10 Creating Object Models with UML

What Is UML?

Unified Modeling Language.

The Structure of a Class Diagram

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.

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章