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

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.

主站蜘蛛池模板: 阿拉善右旗| 苏州市| 甘孜县| 新绛县| 镇江市| 上虞市| 吉林省| 多伦县| 友谊县| 鞍山市| 嫩江县| 根河市| 阿拉善盟| 孙吴县| 库车县| 高清| 巫溪县| 扬州市| 定西市| 平江县| 英超| 嘉鱼县| 东辽县| 镇远县| 枣庄市| 天气| 天台县| 彝良县| 灵丘县| 潜山县| 额尔古纳市| 桃江县| 彭阳县| 同江市| 竹溪县| 宝兴县| 南涧| 贵溪市| 衡阳县| 大兴区| 阿鲁科尔沁旗|