官术网_书友最值得收藏!

Class diagrams

The class diagram is the most commonly used UML diagram, as it provides a visual description of a system's objects. Consider that, in Java, everything is an object, so you can see the relevance and reason as to why this particular diagram is so widely used. Class diagrams do more than just display objects—they visually depict their construction and relationships with other classes. 

As you can see here, the basic component of the class diagram is a rectangle, divided into three sections. Each overall rectangle represents a class, and the class name appears using a bold typeface in the top section. The middle section contains attributes that correlate to variable fields. The third section contains operation data which, in Java, means functions and methods:

The class diagram structure

A simple example of a class diagram for a Kennel is displayed in the following diagram. The class name is Kennel, and there are three attributes (animal, breed, and name) and two operations (intake and discharge):

A class diagram of our Kennel class

We will further explore class diagrams using our Kennel class example later in this chapter.

主站蜘蛛池模板: 运城市| 永靖县| 略阳县| 金昌市| 昭苏县| 桂东县| 高安市| 通道| 祁东县| 古浪县| 项城市| 呼伦贝尔市| 灵台县| 康保县| 金沙县| 杭锦后旗| 沁阳市| 游戏| 汉阴县| 友谊县| 炉霍县| 葫芦岛市| 阜新| 开原市| 陆丰市| 千阳县| 孟连| 盖州市| 房山区| 冀州市| 黎城县| 杭锦后旗| 孟村| 磴口县| 乌海市| 伊春市| 社会| 六枝特区| 丹寨县| 信宜市| 汤阴县|