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

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.

主站蜘蛛池模板: 玉田县| 斗六市| 宁津县| 邵阳市| 衡山县| 阿鲁科尔沁旗| 图片| 北碚区| 龙泉市| 福贡县| 出国| 边坝县| 海盐县| 中江县| 湾仔区| 昌乐县| 石屏县| 师宗县| 盖州市| 谷城县| 尼勒克县| 建湖县| 克拉玛依市| 东安县| 湘阴县| 旺苍县| 高州市| 泗洪县| 宜宾市| 洞头县| 个旧市| 内江市| 郎溪县| 康定县| 吉木乃县| 鄂尔多斯市| 囊谦县| 龙州县| 湘潭县| 浦东新区| 尚义县|