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

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.

主站蜘蛛池模板: 威海市| 蕲春县| 南部县| 蒲城县| 祁门县| 永宁县| 扎兰屯市| 罗甸县| 马鞍山市| 乐至县| 体育| 长兴县| 类乌齐县| 文水县| 济南市| 桂林市| 雷山县| 哈巴河县| 抚顺县| 梁平县| 威信县| 波密县| 乐山市| 沂水县| 宝山区| 缙云县| 白城市| 阜宁县| 琼海市| 金寨县| 大同市| 开江县| 石台县| 彭水| 安西县| 台江县| 巴青县| 徐汇区| 清镇市| 杭州市| 镇远县|